1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
_set_snap_confine_caps() {
/usr/bin/setcap -q - /usr/lib/snapd/snap-confine < /usr/lib/snapd/snap-confine.v2-only.caps
}
## arg 1: the new package version
post_install() {
_set_snap_confine_caps
echo
echo 'To use snapd start/enable the snapd.socket'
echo
echo 'If you want your apps to be automatically updated'
echo 'from the store start/enable the snapd.service'
echo
echo 'NOTE: Desktop entries show up after logging in again'
echo ' or rebooting after snapd installation'
echo
echo 'For more informations, see https://wiki.archlinux.org/index.php/Snapd'
}
_systemctl_do_for_all() {
/usr/bin/systemctl "$@" \
snapd.service \
snapd.socket > /dev/null 2>&1
}
_stop_services() {
_systemctl_do_for_all stop
}
_disable_services() {
_systemctl_do_for_all --no-reload disable
}
pre_remove() {
_stop_services
_disable_services
/usr/lib/snapd/snap-mgmt --purge || :
}
pre_upgrade() {
_stop_services
}
post_upgrade() {
_set_snap_confine_caps
/usr/bin/systemctl daemon-reload > /dev/null 2>&1 || :
# restore the services after an upgrade
if /usr/bin/systemctl -q is-enabled snapd.socket > /dev/null 2>&1; then
/usr/bin/systemctl start snapd.socket > /dev/null 2>&1 || :
fi
}
# vim:set ts=2 sw=2 et:
|