2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 08:52:15 +00:00
Files
xcat-core/xCAT-server/debian/prerm
T
2026-10-22 17:33:44 -03:00

62 lines
1.8 KiB
Bash

#!/bin/sh
# prerm script for xCAT-server
#
# see: dh_installdeb(1)
set -e
xcatd_init_compat=/opt/xcat/share/xcat/scripts/xcatd-init-compat
# 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 ] &&
[ "$(stat -c '%d:%i' /)" = "$(stat -c '%d:%i' /proc/1/root/. 2>/dev/null)" ]; then
if "$xcatd_init_compat" can-use-systemctl; then
systemctl stop xcatd.service
systemctl disable --now xcat-uftp-listener.service >/dev/null 2>&1 || true
elif ! "$xcatd_init_compat" uses-systemd --explicit-target && [ -x /etc/init.d/xcatd ]; then
/etc/init.d/xcatd stop
fi
fi
if "$xcatd_init_compat" uses-systemd --explicit-target; then
if command -v systemctl >/dev/null 2>&1; then
systemctl disable xcatd.service
systemctl disable xcat-uftp-listener.service >/dev/null 2>&1 || true
fi
else
if command -v update-rc.d >/dev/null 2>&1; then
update-rc.d -f xcatd remove
fi
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