diff options
| author | Jason Reiss <jreiss@multitech.com> | 2017-11-02 08:52:14 -0500 |
|---|---|---|
| committer | Jason Reiss <jreiss@multitech.com> | 2017-11-02 08:52:14 -0500 |
| commit | 0a9ea1d77d0797be056ca04ff6b316479c9346c4 (patch) | |
| tree | 1a7f7b9715575fdedcf19fce84bd159ab7199223 /recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper | |
| parent | 0251c4c1414dbc3d8197b8651af9453f94bf4aeb (diff) | |
| parent | 7528642f57dadd17e553b9fd6074c6458c7f78c1 (diff) | |
| download | meta-mlinux-0a9ea1d77d0797be056ca04ff6b316479c9346c4.tar.gz meta-mlinux-0a9ea1d77d0797be056ca04ff6b316479c9346c4.tar.bz2 meta-mlinux-0a9ea1d77d0797be056ca04ff6b316479c9346c4.zip | |
Merge branch '3' of gitlab.multitech.net:mirrors/meta-mlinux into 3
Diffstat (limited to 'recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper')
| -rw-r--r-- | recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper b/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper new file mode 100644 index 0000000..db54d46 --- /dev/null +++ b/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Borrowing heavily from the dnsmasq initscript's version of support for +# resolvconf, intended for use in systemd-only configurations. +# +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/dnsmasq +NAME=dnsmasq + +# Most configuration options in /etc/default/dnsmasq are deprecated +# but still honoured. +if [ -r /etc/default/$NAME ]; then + . /etc/default/$NAME +fi + +start_resolvconf() +{ + # If interface "lo" is explicitly disabled in /etc/default/dnsmasq + # Then dnsmasq won't be providing local DNS, so don't add it to + # the resolvconf server set. + for interface in $DNSMASQ_EXCEPT + do + [ $interface = lo ] && return + done + + if [ -x /sbin/resolvconf ] ; then + echo "nameserver 127.0.0.1" | + /sbin/resolvconf -a lo.$NAME + fi + return 0 +} + +stop_resolvconf() +{ + if [ -x /sbin/resolvconf ] ; then + /sbin/resolvconf -d lo.$NAME + fi + return 0 +} + +case "$1" in + start) + start_resolvconf + exit 0 + ;; + stop) + stop_resolvconf + exit 0 + ;; + restart) + stop_resolvconf + start_resolvconf + exit 0 + ;; + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2 + exit 3 + ;; +esac + +exit 0 + |
