Skip to content

Instantly share code, notes, and snippets.

@bryant1410
Last active November 20, 2018 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryant1410/93474806716eeff537257518842bcff1 to your computer and use it in GitHub Desktop.
Save bryant1410/93474806716eeff537257518842bcff1 to your computer and use it in GitHub Desktop.
This script is a workaround to refresh the snaps under a NFS /home directory with root_squash option (the default).
#!/usr/bin/env bash
# This script is a workaround to refresh the snaps under a NFS /home directory with root_squash option (the default).
# Note that using no_root_squash is insecure.
# The bug was already filed: https://bugs.launchpad.net/snappy/+bug/1804281
set -ex
BACKUP_DIR=/s # CREATE AND/OR CHANGE THIS.
# Because of NFS issues, sometimes moving fails to erase the source, so it's better to copy and then remove.
cp -r ~/snap "${BACKUP_DIR}/"
rm -rf ~/snap
ln -s "${BACKUP_DIR}/snap" ~/snap
sudo snap refresh
rm ~/snap
mv "${BACKUP_DIR}/snap" ~/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment