aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2018-09-14 18:00:23 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2018-09-14 18:00:23 +0300
commit08a6acf23e0c40f676419a3013101869937da695 (patch)
treecdd9b573f7426bcacdc6e7d0dc23435ffed88335 /main
parentd3f643b6a8bf6e4341bca4f133a5de8615978b25 (diff)
downloadaports-08a6acf23e0c40f676419a3013101869937da695.tar.gz
aports-08a6acf23e0c40f676419a3013101869937da695.tar.bz2
aports-08a6acf23e0c40f676419a3013101869937da695.tar.xz
main/tunnel: moved from testing
Diffstat (limited to 'main')
-rw-r--r--main/tunnel/APKBUILD23
-rw-r--r--main/tunnel/tunnel26
2 files changed, 49 insertions, 0 deletions
diff --git a/main/tunnel/APKBUILD b/main/tunnel/APKBUILD
new file mode 100644
index 0000000000..ccbb3948bd
--- /dev/null
+++ b/main/tunnel/APKBUILD
@@ -0,0 +1,23 @@
+# Contributor: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+# Maintainer: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+pkgname=tunnel
+pkgver=1.0
+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="87d643652244f55cb0058d25256a978a963ab197123e4ac3849958ac73dd6f87b82d742fd7a018001069a87a7014a91bf866b707dd941d055375cbaa1b5d940b tunnel"
diff --git a/main/tunnel/tunnel b/main/tunnel/tunnel
new file mode 100644
index 0000000000..a710f6b644
--- /dev/null
+++ b/main/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