aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-02-03 11:53:50 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2017-02-03 11:53:50 +0200
commita4ba93fb5681f520f13bb2ae098a18e2f8e67f24 (patch)
tree818ebb37ea5b35072bbb22a421c5773df6c51221 /main
parent79d05d5869dd1c88ef2f5d193d5527ff9b4cbe11 (diff)
downloadaports-a4ba93fb5681f520f13bb2ae098a18e2f8e67f24.tar.bz2
aports-a4ba93fb5681f520f13bb2ae098a18e2f8e67f24.tar.xz
main/static-routing: moved from testing
Diffstat (limited to 'main')
-rw-r--r--main/static-routing/APKBUILD25
-rw-r--r--main/static-routing/static-routing27
2 files changed, 52 insertions, 0 deletions
diff --git a/main/static-routing/APKBUILD b/main/static-routing/APKBUILD
new file mode 100644
index 0000000000..7c0f835eb7
--- /dev/null
+++ b/main/static-routing/APKBUILD
@@ -0,0 +1,25 @@
+# Contributor: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+# Maintainer: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+pkgname=static-routing
+pkgver=1.0
+pkgrel=0
+pkgdesc="Script for configuring static routing"
+url=http://git.alpinelinux.org/cgit/aports/tree/testing/static-routing
+arch=noarch
+license=GPL-2
+depends=
+source=static-routing
+
+build() {
+ :
+}
+
+package() {
+ install -D -m 755 "$srcdir/static-routing" "$pkgdir/etc/network/if-up.d/static-routing"
+ install -d -m 755 "$pkgdir/etc/network/if-down.d"
+ ln -s ../if-up.d/static-routing "$pkgdir/etc/network/if-down.d"
+}
+
+md5sums="4cf33f3ace8112f7817caf83158ae66f static-routing"
+sha256sums="9070f883e73453573e27fc9b6a689f70c0ca5f5d3f7296d27add0d9f3930c6bb static-routing"
+sha512sums="89ace46345ee43961ca38c67d841d598c38f5c6765317b8353e360d761ea31f128c656095632b20eeedf683e4ae4337c5d177422779491e9bb027289e82a34a8 static-routing"
diff --git a/main/static-routing/static-routing b/main/static-routing/static-routing
new file mode 100644
index 0000000000..b4459f51eb
--- /dev/null
+++ b/main/static-routing/static-routing
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# Static routing configuration script
+# Copyright (c) 2016 Kaarle Ritvanen
+
+if [ $MODE = start ]; then
+ ACTION=add
+elif [ $MODE = stop ]; then
+ ACTION=del
+else
+ exit 1
+fi
+
+configure() {
+ local class=$1
+ shift
+
+ local entry
+ IFS=,
+ for entry in $(eval "echo \"\$IF_$(echo $class | tr a-z A-Z)\""); do
+ IFS=" "
+ ip $class $ACTION $entry $*
+ done
+}
+
+configure route src $IF_ADDRESS dev $IFACE
+configure rule