Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
cmd/snap-mgmt: introduce snap-mgmt tool #4316
Merged
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fdf9277
cmd/snap-mgmt, packaging/fedora: move snap-mgmt helper to cmd/snap-mgmt
bboozzoo 342cb96
cms/snap-mgmt: merge Ubuntu/Debian postrm and Fedora's snap-mgmt into…
bboozzoo 3186b0c
cmd/snap-mgmt: generate snap-mgmt
bboozzoo f73803a
packaging/ubuntu: install snap-mgmt tool
bboozzoo cc8ef64
packaging/fedora: use snapd provided snap-mgmt tool
bboozzoo 44cec06
cmd/snap-mgmt: replace use of /snap with SNAP_MOUNT_DIR
bboozzoo 5424529
tests/lib: use cmd/snap-mgmt in reset code
bboozzoo a629da5
tests/main/postrm-purge: update test to use snap-mgmt where possible
bboozzoo
Jump to file or symbol
Failed to load files and symbols.
Viewing a subset of changes. View all
cmd/snap-mgmt: replace use of /snap with SNAP_MOUNT_DIR
Cleanup remaining uses of /snap and replace them with SNAP_MOUNT_DIR Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
- Loading branch information...
commit 44cec064f04899d4821093b0c69459df5e331926
bboozzoo
committed
Nov 30, 2017
| @@ -42,16 +42,16 @@ purge() { | ||
| # snap.mount.service is a trusty thing | ||
|
|
||
| systemctl_stop snap.mount.service | ||
| else | ||
| - # undo any bind mount to /snap that resulted from LP:#1668659 | ||
| + # undo any bind mount to ${SNAP_MOUNT_DIR} that resulted from LP:#1668659 | ||
| # (that bug can't happen in trusty -- and doing this would mess up snap.mount.service there) | ||
|
|
||
| - if grep -q "/snap /snap" /proc/self/mountinfo; then | ||
| - umount -l /snap || true | ||
| + if grep -q "${SNAP_MOUNT_DIR} ${SNAP_MOUNT_DIR}" /proc/self/mountinfo; then | ||
| + umount -l "${SNAP_MOUNT_DIR}" || true | ||
| fi | ||
| fi | ||
| units=$(systemctl list-unit-files --full | grep -vF snap.mount.service || true) | ||
| - mounts=$(systemctl list-unit-files --full | grep "^${SNAP_UNIT_PREFIX}[-.].*\.mount" | cut -f1 -d ' ') | ||
| - services=$(systemctl list-unit-files --full | grep "^${SNAP_UNIT_PREFIX}[-.].*\.service" | cut -f1 -d ' ') | ||
| + mounts=$(echo "$units" | grep "^${SNAP_UNIT_PREFIX}[-.].*\.mount" | cut -f1 -d ' ') | ||
| + services=$(echo "$units" | grep "^${SNAP_UNIT_PREFIX}[-.].*\.service" | cut -f1 -d ' ') | ||
| for unit in $services $mounts; do | ||
| # ensure its really a snap mount unit or systemd unit | ||
| if ! grep -q 'What=/var/lib/snapd/snaps/' "/etc/systemd/system/$unit" && ! grep -q 'X-Snappy=yes' "/etc/systemd/system/$unit"; then | ||
| @@ -127,7 +127,8 @@ purge() { | ||
| if test -d /etc/apparmor.d; then | ||
| echo "Removing extra snap-confine apparmor rules" | ||
| - rm -f /etc/apparmor.d/snap.core.*.usr.lib.snapd.snap-confine | ||
| + # shellcheck disable=SC2046 | ||
| + rm -f /etc/apparmor.d/$(echo "$SNAP_UNIT_PREFIX" | tr '-' '.').core.*.usr.lib.snapd.snap-confine | ||
Conan-Kudo
Contributor
|
||
| fi | ||
| } | ||
Please do not refer to distribution releases by specific codenames, refer to them by their full names. Context is important for a multi-distribution script.