14c4bd7bf8
This commit fixes the S10hyperv SysV init script which expects binaries to be locate in /sbin while they are installed in /usr/sbin. Please note, that the systemd init scripts correctly reference them. Furthermore, the SysV init script did not check for an actual HyperV environment to be present, which is also corrected. In addition, this commit also fixes check-package warnings regarding a missing DAEMON definition. Signed-off-by: Jens Maus <mail@jens-maus.de> [Peter: drop from .checkpackageignore] Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
71 lines
1.2 KiB
Bash
71 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
PROGS="@PROGS@"
|
|
PIDDIR="/var/run"
|
|
DAEMON="hyperv"
|
|
|
|
# shellcheck source=/dev/null
|
|
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
|
|
|
# only continue if we are in a HyperV platform
|
|
[ -e "/sys/bus/vmbus" ] || exit 0
|
|
|
|
start_one() {
|
|
printf 'Starting %s: ' "$1"
|
|
# shellcheck disable=SC2086 # we need the word splitting
|
|
start-stop-daemon -b -m -S -q -p "$PIDDIR/$1.pid" -x "/usr/sbin/$1" -- -n
|
|
status=$?
|
|
if [ "$status" -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
return $status
|
|
}
|
|
|
|
start() {
|
|
# shellcheck disable=SC2086 # we need the word splitting
|
|
for prog in ${PROGS}; do
|
|
start_one "${prog}" || ret=$?
|
|
done
|
|
return "$ret"
|
|
}
|
|
|
|
stop_one() {
|
|
printf 'Stopping %s: ' "$1"
|
|
start-stop-daemon -K -q -p "$PIDDIR/$1.pid"
|
|
status=$?
|
|
if [ "$status" -eq 0 ]; then
|
|
rm -f "$PIDDIR/$1.pid"
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
return $status
|
|
}
|
|
|
|
stop() {
|
|
# shellcheck disable=SC2086 # we need the word splitting
|
|
for prog in ${PROGS}; do
|
|
stop_one "${prog}" || ret=$?
|
|
done
|
|
return "$ret"
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
sleep 1
|
|
start
|
|
}
|
|
|
|
case "$1" in
|
|
start|stop|restart)
|
|
"$1";;
|
|
reload)
|
|
# Restart, since there is no true "reload" feature.
|
|
restart;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|reload}"
|
|
exit 1
|
|
esac
|