summarylogtreecommitdiffstats
path: root/00-pdnsd
diff options
context:
space:
mode:
authorFrederik "Freso" S. Olesen2012-09-27 21:32:58 +0200
committerFrederik “Freso” S. Olesen2012-09-27 21:32:58 +0200
commitffe76cfc1fb5b95f9069479e1217d10b69b839a9 (patch)
tree05694b7259fd8327c33de4115cdcdd9310a26f20 /00-pdnsd
parentb9fd6557f06efcfe385be1a2dfd0d134dc69b4f6 (diff)
downloadaur-ffe76cfc1fb5b95f9069479e1217d10b69b839a9.tar.gz
networkmanager-dispatcher-pdnsd: Abstracted init system calls to pdnsd_init_command().
Diffstat (limited to '00-pdnsd')
-rwxr-xr-x00-pdnsd58
1 files changed, 19 insertions, 39 deletions
diff --git a/00-pdnsd b/00-pdnsd
index b6049d26aa13..c876b6600cc9 100755
--- a/00-pdnsd
+++ b/00-pdnsd
@@ -28,59 +28,39 @@ pdnsd_is_running() {
esac
}
+pdnsd_init_command() {
+ # Give pDNSd a command through the init system
+ case "$INIT" in
+ 'systemd')
+ exec systemctl $1 pdnsd.service
+ ;;
+ 'init')
+ exec rc.d $1 pdnsd
+ ;;
+ *)
+ no_valid_init
+ ;;
+ esac
+}
+
pdnsd_going_up() {
if ! pdnsd_is_running; then
# pDNSd isn't running. Start it.
- case "$INIT" in
- 'systemd')
- systemctl start pdnsd.service
- ;;
- 'init')
- rc.d start pdnsd
- ;;
- esac
+ pdnsd_init_command start
else
# pDNSd is running. Restart it.
- case "$INIT" in
- 'systemd')
- systemctl restart pdnsd.service
- ;;
- 'init')
- rc.d restart pdnsd
- ;;
- esac
-
+ pdnsd_init_command restart
fi
}
pdnsd_going_down() {
# Check for active interface, take offline if none is active
if [ ! `nm-tool|grep State|cut -f2 -d' '` = 'connected' ]; then
- case "$INIT" in
- 'systemd')
- systemctl stop pdnsd.service
- ;;
- 'init')
- rc.d stop pdnsd
- ;;
- *)
- no_valid_init
- ;;
- esac
+ pdnsd_init_command stop
else
# If another interface is active, restart so we're sure we're using
# the active connection.
- case "$INIT" in
- 'systemd')
- systemctl restart pdnsd.service
- ;;
- 'init')
- rc.d restart pdnsd
- ;;
- *)
- no_valid_init
- ;;
- esac
+ pdnsd_init_command restart
fi
}