2017-12-03 23:27:09 +02:00

27 lines
399 B
Bash

#!/bin/sh
# Tunnel interface configuration script
# Copyright (c) 2017 Kaarle Ritvanen
PARAMS=$(set | sed -E '
s/^IF_TUNNEL_([A-Z0-9_]+)=(.+)/\1\n\2/
ta
d
:a
h
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
P
g
s/.*\n//
')
[ "$PARAMS" ] || exit 0
if [ $MODE = start ]; then
eval ip tunnel add $IFACE $PARAMS
elif [ $MODE = stop ]; then
ip tunnel del $IFACE
else
exit 1
fi