Add files required for Debian packaging
* Systemd unit file for networking.service * Small wrapper script called by networking.service * Defaults file for networking.service Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
044d8307f9
commit
bd8ad91de6
3 changed files with 96 additions and 0 deletions
68
dist/debian/networking
vendored
Normal file
68
dist/debian/networking
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Wrapper script for networking set up and teardown via unit file
|
||||
#
|
||||
# Thu, 01 Oct 2020 22:47:43 +0200
|
||||
# -- Maximilian Wilhelm <max@sdn.clinic>
|
||||
#
|
||||
|
||||
STATE_DIR="/run/ifsate"
|
||||
|
||||
# Make sure the state dir is present
|
||||
if [ ! -d "${STATE_DIR}" ]; then
|
||||
mkdir "${STATE_DIR}"
|
||||
fi
|
||||
|
||||
# Check for require binaries
|
||||
if [ ! -x /sbin/ifup -o ! -x /sbin/ifdown ]; then
|
||||
echo "ifup and/or ifdown not found!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply defaults if present (verbose mode, kill switch, etc.)
|
||||
CONFIGURE_INTERFACES=yes
|
||||
|
||||
if [ -f /etc/default/networking ]; then
|
||||
. /etc/default/networking
|
||||
fi
|
||||
|
||||
ARGS=""
|
||||
if [ "${VERBOSE}" = yes ]; then
|
||||
ARGS="-v"
|
||||
fi
|
||||
|
||||
# Let's go
|
||||
case "$1" in
|
||||
start)
|
||||
if [ "${CONFIGURE_INTERFACES}" = no ]; then
|
||||
echo "Not configuring network interfaces, see /etc/default/networking"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ifup -a ${ARGS}
|
||||
;;
|
||||
|
||||
stop)
|
||||
if [ "${SKIP_DOWN_AT_SYSRESET}" = "yes" ] && systemctl list-jobs | egrep -q '(shutdown|reboot|halt|poweroff)\.target'; then
|
||||
echo ${NAME}':' "Skipping deconfiguring network interfaces"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ifdown -a ${ARGS}
|
||||
;;
|
||||
|
||||
restart)
|
||||
ifupdown_init
|
||||
ifdown -a ${ARGS}
|
||||
ifup -a ${ARGS}
|
||||
;;
|
||||
|
||||
# reload missing here!
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue