Add preliminary PPP hook scripts
authorBen Hutchings <ben@decadent.org.uk>
Sat, 6 Feb 2016 02:36:40 +0000 (02:36 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 21 Feb 2016 21:23:21 +0000 (21:23 +0000)
debian/odhcp6c.ppp.ipv6-down [new file with mode: 0755]
debian/odhcp6c.ppp.ipv6-up [new file with mode: 0755]
debian/rules

diff --git a/debian/odhcp6c.ppp.ipv6-down b/debian/odhcp6c.ppp.ipv6-down
new file mode 100755 (executable)
index 0000000..89a8967
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+IFACE="$1"
+PID="$(cat "/run/odhcp6c.$IFACE.pid" 2>/dev/null)"
+
+# Was a pid recorded and does the process still exist?
+# XXX should check process name too
+if [ -n "$PID" ] && kill -0 $PID; then
+       # XXX this doesn't currently remove the pid file
+       kill $PID
+else
+       rm -f "/run/odhcp6c.$IFACE.pid"
+fi
diff --git a/debian/odhcp6c.ppp.ipv6-up b/debian/odhcp6c.ppp.ipv6-up
new file mode 100755 (executable)
index 0000000..26bdf3a
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+IFACE="$1"
+# XXX Options need to be configurable
+odhcp6c -P 0 -d -v -f -p "/run/odhcp6c.$IFACE.pid" "$IFACE"
index 2d33f6a..afe0e45 100755 (executable)
@@ -2,3 +2,10 @@
 
 %:
        dh $@
+
+override_dh_install:
+       dh_install
+       install -D -m755 debian/odhcp6c.ppp.ipv6-up \
+               debian/odhcp6c/etc/ppp/ipv6-up.d/odhcp6c
+       install -D -m755 debian/odhcp6c.ppp.ipv6-down \
+               debian/odhcp6c/etc/ppp/ipv6-down.d/odhcp6c