2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-07-31 18:19:40 +00:00
Files
xcat-core/xCAT-server/debian/postrm
T
2026-07-16 01:43:16 -03:00

102 lines
2.4 KiB
Bash

#!/bin/sh
# postrm script for openmpi
#
# see: dh_installdeb(1)
set -e
xcat_target_uses_systemd()
{
if [ -d /run/systemd/system ]; then
return 0
fi
if [ -x /usr/lib/systemd/systemd ] || [ -x /lib/systemd/systemd ]; then
return 0
fi
if [ -L /sbin/init ]; then
init_target=$(readlink /sbin/init 2>/dev/null || true)
case "$init_target" in
*systemd*) return 0 ;;
esac
fi
if [ -r /etc/os-release ]; then
os_id=
os_version=
while IFS='=' read -r key value; do
value=${value#\"}
value=${value%\"}
value=${value#\'}
value=${value%\'}
case "$key" in
ID) os_id=$value ;;
VERSION_ID) os_version=$value ;;
esac
done < /etc/os-release
if [ "$os_id" = "debian" ] && [ -z "$os_version" ]; then
return 0
fi
os_major=${os_version%%.*}
case "$os_major" in
''|*[!0-9]*) return 1 ;;
esac
case "$os_id" in
ubuntu) [ "$os_major" -ge 15 ] && return 0 ;;
debian) [ "$os_major" -ge 8 ] && return 0 ;;
esac
fi
return 1
}
if xcat_target_uses_systemd && \
command -v dpkg-maintscript-helper >/dev/null 2>&1 && \
dpkg-maintscript-helper supports rm_conffile; then
dpkg-maintscript-helper rm_conffile /etc/init.d/xcatd -- "$@"
fi
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge)
rm -f /etc/init.d/xcatd
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
remove)
rm -f /usr/sbin/xcatd #remove the symbolic
rm -f /etc/apache2/conf-enabled/xcat-ws.conf
;;
*)
echo "postrm 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