From a93f5ff4910d358dafd67132addd9c6fe6d6477e Mon Sep 17 00:00:00 2001 From: satan1st Date: Tue, 8 Aug 2023 08:34:50 +0200 Subject: [PATCH] add ifupdown integration (#31) * add ifupdown integration * fixup! add ifupdown integration --------- Co-authored-by: satanist --- scripts/clatd.ifupdown | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 scripts/clatd.ifupdown diff --git a/scripts/clatd.ifupdown b/scripts/clatd.ifupdown new file mode 100755 index 0000000..aa21058 --- /dev/null +++ b/scripts/clatd.ifupdown @@ -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