mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-07-31 18:19:40 +00:00
92 lines
2.8 KiB
Bash
92 lines
2.8 KiB
Bash
#!/bin/sh
|
|
# postinst script for openmpi
|
|
#
|
|
# see: dh_installdeb(1)
|
|
|
|
set -e
|
|
|
|
xcat_can_use_systemctl()
|
|
{
|
|
[ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1
|
|
}
|
|
|
|
xcatd_init_compat=/opt/xcat/share/xcat/scripts/xcatd-init-compat
|
|
|
|
if "$xcatd_init_compat" 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:
|
|
# * <postinst> `configure' <most-recently-configured-version>
|
|
# * <old-postinst> `abort-upgrade' <new version>
|
|
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
|
# <new-version>
|
|
# * <postinst> `abort-remove'
|
|
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
|
# <failed-install-package> <version> `removing'
|
|
# <conflicting-package> <version>
|
|
# for details, see http://www.debian.org/doc/debian-policy/ or
|
|
# the debian-policy package
|
|
|
|
|
|
case "$1" in
|
|
configure)
|
|
. /etc/profile.d/xcat.sh
|
|
xcat_server_upgrade=0
|
|
if [ -f /tmp/xCAT-server_upgrade.tmp ]; then
|
|
xcat_server_upgrade=1
|
|
fi
|
|
|
|
if "$xcatd_init_compat" uses-systemd; then
|
|
legacy_xcatd_enabled=0
|
|
if ls /etc/rc?.d/S??xcatd >/dev/null 2>&1; then
|
|
legacy_xcatd_enabled=1
|
|
fi
|
|
if [ "$xcat_server_upgrade" = "1" ] && command -v update-rc.d >/dev/null 2>&1; then
|
|
update-rc.d -f xcatd remove
|
|
fi
|
|
|
|
"$xcatd_init_compat" configure
|
|
if xcat_can_use_systemctl; then
|
|
systemctl daemon-reload
|
|
fi
|
|
if command -v systemctl >/dev/null 2>&1 && \
|
|
{ [ "$xcat_server_upgrade" = "0" ] || [ "$legacy_xcatd_enabled" = "1" ]; }; then
|
|
# Fresh installs are enabled by default. Upgrades preserve the
|
|
# legacy enabled state so HA nodes remain disabled.
|
|
systemctl enable xcatd.service
|
|
fi
|
|
else
|
|
"$xcatd_init_compat" configure
|
|
if [ "$xcat_server_upgrade" = "0" ] && \
|
|
[ -x /etc/init.d/xcatd ] && \
|
|
command -v update-rc.d >/dev/null 2>&1; then
|
|
update-rc.d xcatd defaults
|
|
fi
|
|
fi
|
|
|
|
if [ "$xcat_server_upgrade" = "1" ]; then
|
|
# No need to reload xcatd here as it will be covered by xCAT/xCATsn now.
|
|
rm -f /tmp/xCAT-server_upgrade.tmp
|
|
fi
|
|
ln -sf /opt/xcat/sbin/xcatd /usr/sbin/xcatd
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst 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
|