add ifupdown integration (#31)

* add ifupdown integration

* fixup! add ifupdown integration

---------

Co-authored-by: satanist <satanist+fsmi@bureaucracy.de>
This commit is contained in:
satan1st
2023-08-08 08:34:50 +02:00
committed by GitHub
parent b8a7092873
commit a93f5ff491

49
scripts/clatd.ifupdown Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# clatd(8) integration in interfaces(5)
# To use just copy this script to /etc/network/if-up.d/ and
# /etc/network/if-down.d/
# To configure which connection should include clatd the file
# /etc/default/clatd is used. To enable clatd on a interface
# include the interface in CLATD_IFACES (space sperated)
# For logical intefaces (i.e. wpa_supplicant integration) you
# can also set one CLATD_LOGICAL. See interfaces(5) for details.
. /etc/default/clatd
use_clatd=0
for iface in $CLATD_IFACES
do
if [ "$iface" = "$IFACE" ]
then
use_clatd=1
break
fi
done
if [ "$LOGICAL" = "$CLATD_LOGICAL" ]
then
use_clatd=1
fi
if [ "$use_clatd" -ne 1 ]
then
exit 0
fi
case "$PHASE" in
post-up)
systemctl start clatd@"$IFACE"
exit 0
;;
pre-down)
systemctl stop clatd@"$IFACE"
;;
*)
exit 0
;;
esac