shorewall_code/Shorewall-core/stop_service.debian
Jeremy Sowden badf2fc9f0 Support SAFESTOP under systemd
By default, in Debian and its derivatives, stopping the Shorewall
service executes `/sbin/shorewall clear`.

The `SAFESTOP` setting in /etc/default/shorewall is intended to stop the
service by calling `/sbin/shorewall stop`.

However, the systemd service files do not support this.  Instead,
install a shell-script that sources /etc/default/shorewall and honours
`SAFESTOP` when stopping Shorewall and patch the service files to call
it.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
2023-09-09 12:48:07 +01:00

20 lines
256 B
Bash

#!/bin/sh
PRODUCT=$1
. /etc/default/${PRODUCT}
if [ "$SAFESTOP" = 1 ]; then
COMMAND=stop
else
COMMAND=clear
fi
if [ "${PRODUCT}" = shorewall6 ]; then
EXEC="/sbin/shorewall -6"
else
EXEC="/sbin/${PRODUCT}"
fi
exec ${EXEC} ${OPTIONS} ${COMMAND}