summarylogtreecommitdiffstats
path: root/00-pdnsd
diff options
context:
space:
mode:
authorFrederik "Freso" S. Olesen2012-01-03 09:20:02 +0100
committerFrederik “Freso” S. Olesen2012-01-03 09:20:02 +0100
commit1087f942668dfb74d0ec21e74ac3075410ec0489 (patch)
tree8f731d3bae4e8fec5c26a3b2a148777fc3c72237 /00-pdnsd
parent92b289ed3d640ca15dc78430280a5a8bba43f647 (diff)
downloadaur-1087f942668dfb74d0ec21e74ac3075410ec0489.tar.gz
networkmanager-dispatcher-pdnsd: Renamed script file.
Using "00-" instead of "10-" as we'll want DNS to be available as soon as we get a connection.
Diffstat (limited to '00-pdnsd')
-rw-r--r--00-pdnsd40
1 files changed, 40 insertions, 0 deletions
diff --git a/00-pdnsd b/00-pdnsd
new file mode 100644
index 000000000000..581a575c611f
--- /dev/null
+++ b/00-pdnsd
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+INTERFACE=$1
+STATUS=$2
+
+# Chrony set-up
+CHRONY=/usr/bin/chronyc
+CONFIG=/etc/chrony.conf
+KEYFILE=`grep ^keyfile $CONFIG | sed 's/[^ ]* //' -`
+COMMANDKEY=`grep ^commandkey $CONFIG | sed 's/[^ ]* //' -`
+PASSWORD=`grep ^$COMMANDKEY $KEYFILE | sed 's/[^ ]* //' -`
+
+chrony_cmd() {
+ echo Chrony going $1.
+ exec $CHRONY <<EOF
+password $PASSWORD
+$1
+EOF
+}
+
+case "$STATUS" in
+ up)
+ chrony_cmd online
+ ;;
+ vpn-up)
+ chrony_cmd online
+ ;;
+ down)
+ # Check for active interface, take offline if none is active
+ if [ ! `nm-tool|grep State|cut -f2 -d' '` = 'connected' ]; then
+ chrony_cmd offline
+ fi
+ ;;
+ vpn-down)
+ # Check for active interface, take offline if none is active
+ if [ ! `nm-tool|grep State|cut -f2 -d' '` = 'connected' ]; then
+ chrony_cmd offline
+ fi
+ ;;
+esac