Merge pull request #88 from BarbarossaTM/feature/debian-packaging

Add files required for Debian packaging
This commit is contained in:
Maximilian Wilhelm 2020-10-02 03:09:37 +02:00 committed by GitHub
commit 0b23f5bc86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 0 deletions

View 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
View 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
View 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"