2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-05-06 00:59:13 +00:00
Files
xcat-core/xCAT-server/debian/prerm
2026-05-04 18:13:23 -03:00

58 lines
1.4 KiB
Bash

#!/bin/sh
# prerm script for xCAT-server
#
# see: dh_installdeb(1)
set -e
xcat_can_use_systemctl()
{
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
}
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove)
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
if xcat_can_use_systemctl; then
systemctl stop xcatd.service
elif [ -x /etc/init.d/xcatd ]; then
/etc/init.d/xcatd stop
fi
fi
if xcat_can_use_systemctl; then
systemctl disable xcatd.service
elif command -v update-rc.d >/dev/null 2>&1; then
update-rc.d -f xcatd remove
fi
;;
upgrade|deconfigure)
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0