aboutsummaryrefslogtreecommitdiffstats
path: root/main/pingu
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-08-21 14:55:52 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-08-21 14:56:56 +0000
commitcf10e9169fa34e9e09f055f4fe338045d34bd372 (patch)
tree3536fe83bcddd6b1b911f612e8155ab6fdc02563 /main/pingu
parentba29d2187341d958c329d19b4a78310a084172b8 (diff)
downloadaports-cf10e9169fa34e9e09f055f4fe338045d34bd372.tar.bz2
aports-cf10e9169fa34e9e09f055f4fe338045d34bd372.tar.xz
main/pingu: add support for static route rules
Users can add static route rules in /etc/pingu/route-rules The rules will be added when startup and removed when stop
Diffstat (limited to 'main/pingu')
-rw-r--r--main/pingu/APKBUILD8
-rw-r--r--main/pingu/pingu.initd25
2 files changed, 29 insertions, 4 deletions
diff --git a/main/pingu/APKBUILD b/main/pingu/APKBUILD
index 6929dc119e..5c945165a6 100644
--- a/main/pingu/APKBUILD
+++ b/main/pingu/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pingu
pkgver=1.3
-pkgrel=0
+pkgrel=1
pkgdesc="Small daemon that pings hosts and executes a script when status change"
url="http://git.alpinelinux.org/cgit/pingu"
arch="all"
@@ -65,8 +65,8 @@ _lua() {
}
md5sums="0d33bfe66a428ace44bdf968c825ab12 pingu-1.3.tar.gz
-70f56b0f506e1c2e725d0ec062667c32 pingu.initd"
+c24b9cc209e9e34a59ab60d06ab46e11 pingu.initd"
sha256sums="971f3a68d201b2217bb7b4918ad349b0ef5ff19b7015439a174d2bf2d201ad42 pingu-1.3.tar.gz
-cf3197f457d7a5955662417da8a7908a01934bfb5e97cf46c14a1ceab93ad47c pingu.initd"
+7db46892d4af4adf7101bf56fabe6b43974f471c6979ee74948b608b75796d89 pingu.initd"
sha512sums="e2489720268ef7c2e3b1619fd7f1f968db8e546b49769c6f40b12d7db49d39445329df4a6a12d1b5319aee4a89e0665bb188609a85d4b7495f9d5719d37409de pingu-1.3.tar.gz
-b14b4b1ae218c53abec94d4c177327a5a7ed1833cb0160a83c683766d638759c1ed12c73d4cee93a2c09b6296affea20cf15f4dd5a5f2e910ac6f8d7e896ceb4 pingu.initd"
+e9acbeb44d5babf06bb3d2bbb45bd798a38166ef8b6d1c0b9d62891cbae24bc883c92435915f96cbef05d5398d9d7a7dc1aef2e008ab3f7310e358608c479d76 pingu.initd"
diff --git a/main/pingu/pingu.initd b/main/pingu/pingu.initd
index a7a6bef369..47353e79f1 100644
--- a/main/pingu/pingu.initd
+++ b/main/pingu/pingu.initd
@@ -4,8 +4,33 @@ description="MultiISP load balancing and failover"
command=/usr/sbin/pingu
command_args="-d"
pidfile=/var/run/pingu/pingu.pid
+route_rules=/etc/pingu/route-rules
+rundir=${pidfile%/*}
depend() {
need net
after firewall
}
+
+start_pre() {
+ if ! [ -f "$route_rules" ]; then
+ return 0
+ fi
+ sed -e 's/\#.*//' -e '/^$/d' "$route_rules" | while read line; do
+ ebegin "Adding route rule: $line"
+ ip rule add $line && echo $line >> $rundir/route-rules
+ eend
+ done
+}
+
+stop_post() {
+ if ! [ -f "$rundir"/route-rules ]; then
+ return 0
+ fi
+ while read line; do
+ ebegin "Removing route rule: $line"
+ ip rule del $line
+ eend
+ done < "$rundir"/route-rules
+ rm "$rundir"/route-rules
+}