Deleted Added
full compact
dnsmasq.in (302408) dnsmasq.in (304515)
1#!/bin/sh
1#!/bin/sh
2# Copyright (c) 2007-2012 Roy Marples
2# Copyright (c) 2007-2016 Roy Marples
3# All rights reserved
4
5# dnsmasq subscriber for resolvconf
6
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10# * Redistributions of source code must retain the above copyright

--- 21 unchanged lines hidden (view full) ---

32[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
33NL="
34"
35
36: ${dnsmasq_pid:=/var/run/dnsmasq.pid}
37[ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
38[ -s "$dnsmasq_pid" ] || unset dnsmasq_pid
39: ${dnsmasq_service:=dnsmasq}
3# All rights reserved
4
5# dnsmasq subscriber for resolvconf
6
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10# * Redistributions of source code must retain the above copyright

--- 21 unchanged lines hidden (view full) ---

32[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
33NL="
34"
35
36: ${dnsmasq_pid:=/var/run/dnsmasq.pid}
37[ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
38[ -s "$dnsmasq_pid" ] || unset dnsmasq_pid
39: ${dnsmasq_service:=dnsmasq}
40: ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
41newconf="# Generated by resolvconf$NL"
42newresolv="$newconf"
43
44# Using dbus means that we never have to restart the daemon
45# This is important as it means we should not drop DNS queries
46# whilst changing DNS options around. However, dbus support is optional
47# so we need to validate a few things first.
48# Check for DBus support in the binary

--- 126 unchanged lines hidden (view full) ---

175 printf %s "$newresolv" >"$dnsmasq_resolv"
176 fi
177 else
178 printf %s "$newresolv" >"$dnsmasq_resolv"
179 fi
180fi
181
182if $changed; then
40newconf="# Generated by resolvconf$NL"
41newresolv="$newconf"
42
43# Using dbus means that we never have to restart the daemon
44# This is important as it means we should not drop DNS queries
45# whilst changing DNS options around. However, dbus support is optional
46# so we need to validate a few things first.
47# Check for DBus support in the binary

--- 126 unchanged lines hidden (view full) ---

174 printf %s "$newresolv" >"$dnsmasq_resolv"
175 fi
176 else
177 printf %s "$newresolv" >"$dnsmasq_resolv"
178 fi
179fi
180
181if $changed; then
183 eval $dnsmasq_restart
182 # dnsmasq does not re-read the configuration file on SIGHUP
183 if [ -n "$dnsmasq_restart" ]; then
184 eval $dnsmasq_restart
185 elif [ -n "$RESTARTCMD" ]; then
186 set -- ${dnsmasq_service}
187 eval $RESTARTCMD
188 else
189 @SBINDIR@/resolvconf -r ${dnsmasq_service}
190 fi
184fi
185if $dbus; then
186 if [ -s "$dnsmasq_pid" ]; then
187 $changed || kill -HUP $(cat "$dnsmasq_pid")
188 fi
189 # Send even if empty so old servers are cleared
190 if $dbus_ex; then
191 method=SetDomainServers
192 if [ -n "$dbusdest_ex" ]; then
193 dbusdest_ex="array:string:$dbusdest_ex"
194 fi
195 dbusdest="$dbusdest_ex"
196 else
197 method=SetServers
198 fi
199 dbus-send --system --dest=uk.org.thekelleys.dnsmasq \
200 /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \
201 $dbusdest
202fi
191fi
192if $dbus; then
193 if [ -s "$dnsmasq_pid" ]; then
194 $changed || kill -HUP $(cat "$dnsmasq_pid")
195 fi
196 # Send even if empty so old servers are cleared
197 if $dbus_ex; then
198 method=SetDomainServers
199 if [ -n "$dbusdest_ex" ]; then
200 dbusdest_ex="array:string:$dbusdest_ex"
201 fi
202 dbusdest="$dbusdest_ex"
203 else
204 method=SetServers
205 fi
206 dbus-send --system --dest=uk.org.thekelleys.dnsmasq \
207 /uk/org/thekelleys/dnsmasq uk.org.thekelleys.$method \
208 $dbusdest
209fi