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
15
dist/debian/ifupdown-ng.networking.service
vendored
Normal file
15
dist/debian/ifupdown-ng.networking.service
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[Unit]
|
||||||
|
Description=ifupdown-ng networking initialization
|
||||||
|
Documentation=man:interfaces(5) man:ifup(8) man:ifdown(8)
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
SyslogIdentifier=networking
|
||||||
|
TimeoutStopSec=30s
|
||||||
|
ExecStart=/usr/share/ifupdown-ng/sbin/networking start
|
||||||
|
ExecStop=/usr/share/ifupdown-ng/sbin/networking stop
|
||||||
|
ExecRestart=/usr/share/ifupdown-ng/sbin/networking restart
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target network.target multi-user.target network-online.target
|
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
|
13
dist/debian/networking.default
vendored
Normal file
13
dist/debian/networking.default
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#
|
||||||
|
# Defaults for ifupdown-ng networking service
|
||||||
|
#
|
||||||
|
|
||||||
|
# Change the below to "yes" if you want ifup/ifdown and it's executors to be
|
||||||
|
# verbose about what's going on
|
||||||
|
VERBOSE="no"
|
||||||
|
|
||||||
|
# Set to "yes" if you want to skip deconfiguring all interfaces during system
|
||||||
|
# reboot and shutdown. This might be of interest in large scale deployments,
|
||||||
|
# where you might not want to wait for interface deconfiguration to speed up
|
||||||
|
# shutdown/reboot.
|
||||||
|
SKIP_DOWN_AT_SYSRESET="yes"
|
Loading…
Reference in a new issue