clatd/scripts/clatd.ifupdown

50 lines
826 B
Bash
Executable File

#!/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