Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Aug 19, 2016
1 parent 6815cd0 commit 48e91d2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions debian/snapd.postrm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ systemctl_stop() {
}

if [ "$1" = "purge" ]; then
mounts="$(systemctl list-unit-files | grep '^snap[-.].*\.mount' | cut -f1 -d ' ')"
services="$(systemctl list-unit-files | grep '^snap[-.].*\.service' | cut -f1 -d ' ')"
mounts=$(systemctl list-unit-files | grep '^snap[-.].*\.mount' | cut -f1 -d ' ')
services=$(systemctl list-unit-files | grep '^snap[-.].*\.service' | cut -f1 -d ' ')
for unit in $services $mounts; do
# ensure its really a snapp 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
Expand All @@ -21,12 +21,12 @@ if [ "$1" = "purge" ]; then
fi

echo "Stopping $unit"
systemctl_stop $unit
systemctl_stop "$unit"

# if it is a mount unit, we can find the snap name in the mount
# unit (we just ignore unit files)
snap="$(grep 'Where=/snap/' /etc/systemd/system/$unit|cut -f3 -d/)"
rev="$(grep 'Where=/snap/' /etc/systemd/system/$unit|cut -f4 -d/)"
snap=$(grep 'Where=/snap/' "/etc/systemd/system/$unit"|cut -f3 -d/)
rev=$(grep 'Where=/snap/' "/etc/systemd/system/$unit"|cut -f4 -d/)
if [ -n "$snap" ]; then
echo "Removing snap $snap"
# generated binaries
Expand All @@ -48,8 +48,8 @@ if [ "$1" = "purge" ]; then
fi

echo "Removing $unit"
rm -f /etc/systemd/system/$unit
rm -f /etc/systemd/system/multi-user.target.wants/$unit
rm -f "/etc/systemd/system/$unit"
rm -f "/etc/systemd/system/multi-user.target.wants/$unit"
done

echo "Removing snapd state"
Expand Down

0 comments on commit 48e91d2

Please sign in to comment.