aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing/tunnel/APKBUILD23
-rw-r--r--testing/tunnel/tunnel26
2 files changed, 49 insertions, 0 deletions
diff --git a/testing/tunnel/APKBUILD b/testing/tunnel/APKBUILD
new file mode 100644
index 00000000000..06f86b65e13
--- /dev/null
+++ b/testing/tunnel/APKBUILD
@@ -0,0 +1,23 @@
+# Contributor: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+# Maintainer: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+pkgname=tunnel
+pkgver=0.1
+pkgrel=0
+pkgdesc="Script for configuring tunnel interfaces"
+url=http://git.alpinelinux.org/cgit/aports/tree/testing/tunnel
+arch=noarch
+license=GPL-2
+depends=
+source=tunnel
+
+build() {
+ :
+}
+
+package() {
+ install -D -m 755 "$srcdir/tunnel" "$pkgdir/etc/network/if-pre-up.d/tunnel"
+ install -d -m 755 "$pkgdir/etc/network/if-post-down.d"
+ ln -s ../if-pre-up.d/tunnel "$pkgdir/etc/network/if-post-down.d"
+}
+
+sha512sums="7d1170dfbc7381f94f45c7866a6e540f167b9e9cffcbdb8478250c2db79e670519d99474e3ad282d46c26cdb86ec9e4b5762c33d9e1e805851207ada6041c67f tunnel"
diff --git a/testing/tunnel/tunnel b/testing/tunnel/tunnel
new file mode 100644
index 00000000000..a710f6b6445
--- /dev/null
+++ b/testing/tunnel/tunnel
@@ -0,0 +1,26 @@
+#!/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