interface-file: remap legacy ifupdown & ifupdown2 tunnel parameters

This commit is contained in:
Ariadne Conill 2020-08-19 02:46:04 -06:00
parent ac56a85074
commit 9cc74b58c4
2 changed files with 36 additions and 1 deletions

30
executor-scripts/linux/tunnel Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
# Based on alpine's tunnel 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
case "$PHASE" in
pre-up)
eval ip tunnel add $IFACE $PARAMS
;;
post-down)
ip tunnel del $IFACE
;;
depend)
echo "$IF_TUNNEL_DEV"
;;
esac