1
0
linux/debian/hyperv-daemons.preinst
Konstantin Demin eb2bdc81cb rewrite scripts
try to provide better syntax and avoid using bash
2024-10-29 05:12:06 +03:00

31 lines
767 B
Bash

#!/bin/sh
set -e
have_systemd=1
[ -d /run/systemd/system ] || have_systemd=0
case "$1" in
upgrade )
services='kvp vss'
if dpkg --compare-versions "$2" lt '6.10~rc6-1~exp1' ; then
services="fcopy ${services}"
fi
for i in ${services} ; do
init_service="hyperv-daemons.hv-$i-daemon"
systemd_unit="${init_service}.service"
if [ ${have_systemd} = 1 ] ; then
systemctl stop "${systemd_unit}" 2>/dev/null || true
fi
deb-systemd-helper purge "${systemd_unit}" || true
invoke-rc.d --skip-systemd-native "${init_service}" stop || true
update-rc.d "${init_service}" remove || true
done ; unset services i init_service systemd_unit
;;
esac
unset have_systemd
#DEBHELPER#
exit 0