prerm is in nut-server 2.7.4-5.1ubuntu2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 58 59 | #!/bin/sh -e
# the DEBHELPER token is purposely not used
# because we don't want the daemon to be
# stopped during an upgrade
handle_start_failure () {
# The MODE defined in /etc/nut/nut.conf shouldn't affect the exit code when the
# daemon is stopped. If it fails to stop, the maintainer script should fail
# too.
return 1
}
case "$1" in
remove)
# nut-usb specifics
[ -f /etc/hotplug/usb/libhid.usermap ] && rm -f /etc/hotplug/usb/libhid.usermap
[ -f /etc/hotplug/usb/libhidups ] && rm -f /etc/hotplug/usb/libhidups
[ -L /usr/doc/nut ] && rm -f /usr/doc/nut
# do stop the daemon on remove
invoke-rc.d nut stop && sleep 1
[ -d /var/run/nut ] && rm -rf /var/run/nut/
;;
upgrade)
[ -L /usr/doc/nut ] && rm -f /usr/doc/nut
# do not stop the daemon on upgrade
;;
failed-upgrade)
# do nothing
;;
deconfigure)
# do nothing
;;
*)
echo "$0: incorrect arguments: $*" >&2
exit 1
;;
esac
# Automatically added by dh_systemd_start/10.10.7ubuntu2
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop 'nut-driver.service' >/dev/null
fi
# End automatically added section
# Automatically added by dh_installinit/10.10.7ubuntu2
if [ -x "/etc/init.d/nut-server" ] && [ "$1" = remove ]; then
invoke-rc.d nut-server stop || handle_start_failure
fi
# End automatically added section
exit 0
|