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
|
#!/bin/sh
set -e
case "$1" in
install|upgrade)
# version 6 is a user daemon so clear out old system level files
if [ -f /usr/lib/systemd/system/psd.service ]; then
[ "$(systemctl is-enabled psd)" = "enabled" ] &&
systemctl disable psd.service &>/dev/null
[ "$(systemctl is-active psd)" = "active" ] &&
systemctl stop psd.service &>/dev/null
fi
for i in $(users); do
if [ "$(su $i -s /bin/bash -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user is-active psd')" = "active" ]; then
echo "--> Internal changes to psd require it to be stopped before the update."
echo "--> Restart it manually: systemctl --user start psd"
su $i -s /bin/bash -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user stop psd.service'
fi
return 0
done
;;
abort-upgrade)
/bin/true
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
|