1
0

rewrite scripts

try to provide better syntax and avoid using bash
This commit is contained in:
2024-10-29 05:12:06 +03:00
parent 1e13062902
commit eb2bdc81cb
24 changed files with 363 additions and 247 deletions

View File

@@ -1,20 +1,29 @@
#!/bin/sh
set -e
if [ "$1" = "upgrade" ]; then
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"
if dpkg --compare-versions "$2" lt '6.10~rc6-1~exp1' ; then
services="fcopy ${services}"
fi
for i in $services; do
if [ -d /run/systemd/system ]; then
systemctl stop hyperv-daemons.hv-$i-daemon.service 2>/dev/null || true
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 hyperv-daemons.hv-$i-daemon.service || true
invoke-rc.d --skip-systemd-native hyperv-daemons.hv-$i-daemon stop || true
update-rc.d hyperv-daemons.hv-$i-daemon remove || true
done
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#