aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-support
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2016-04-26 08:15:44 +0200
committerJoe MacDonald <joe_macdonald@mentor.com>2016-04-29 11:17:13 -0400
commit5aa6f3727f07274a6bc639d850fd201dd667a87c (patch)
tree489a0aa8ce80a91d5ea1e660c4f9af83401e6823 /meta-networking/recipes-support
parentabd1795729501a13608da67054b9cbf185404be3 (diff)
downloadmeta-openembedded-contrib-5aa6f3727f07274a6bc639d850fd201dd667a87c.tar.gz
dnsmasq: get systemd only working again
The changes made in commit 2497cf2960537152427c99629b2af412787eb6c2 [dnsmasq: steal resolvconf support from Ubuntu] broke systemd only dnsmasq runtime. No sysvinit scripts are included in systemd only builds (and should not be) and the dnsmasq executable has not moved to /usr/sbin. Reverting to the previous version of the systemd service file. If folks want the local dnsmasq instance to be queried before going to an external DNS they should add 'nameserver 127.0.0.1' to /etc/resolv.conf. Or submit a change which will work with systemd. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Acked-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> (cherry picked from commit 237ade5065aee5290288febfbbae90145c2c7764)
Diffstat (limited to 'meta-networking/recipes-support')
-rw-r--r--meta-networking/recipes-support/dnsmasq/dnsmasq.inc21
-rw-r--r--meta-networking/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service15
-rw-r--r--meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper62
-rw-r--r--meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service17
-rw-r--r--meta-networking/recipes-support/dnsmasq/files/dnsmasq.service16
5 files changed, 108 insertions, 23 deletions
diff --git a/meta-networking/recipes-support/dnsmasq/dnsmasq.inc b/meta-networking/recipes-support/dnsmasq/dnsmasq.inc
index 622e630679..cc7f9e3be0 100644
--- a/meta-networking/recipes-support/dnsmasq/dnsmasq.inc
+++ b/meta-networking/recipes-support/dnsmasq/dnsmasq.inc
@@ -10,7 +10,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
SRC_URI = "http://www.thekelleys.org.uk/dnsmasq/${@['archive/', ''][float(d.getVar('PV',1).split('.')[1]) > 15]}dnsmasq-${PV}.tar.gz;name=dnsmasq-${PV} \
file://init \
file://dnsmasq.conf \
- file://dnsmasq.service \
+ file://dnsmasq-resolvconf.service \
+ file://dnsmasq-noresolvconf.service \
"
inherit pkgconfig update-rc.d systemd
@@ -33,7 +34,7 @@ EXTRA_OEMAKE = "\
'LDFLAGS=${LDFLAGS}' \
"
-SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq', '', d)}"
+SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq file://dnsmasq-resolvconf-helper', '', d)}"
do_compile_append() {
# build dhcp_release
@@ -51,7 +52,12 @@ do_install () {
install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/dnsmasq
install -d ${D}${systemd_unitdir}/system
- install -m 0644 ${WORKDIR}/dnsmasq.service ${D}${systemd_unitdir}/system
+
+ if [ "${@base_contains('PACKAGECONFIG', 'resolvconf', 'resolvconf', '', d)}" != "" ]; then
+ install -m 0644 ${WORKDIR}/dnsmasq-resolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
+ else
+ install -m 0644 ${WORKDIR}/dnsmasq-noresolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
+ fi
install -m 0755 ${S}/contrib/wrt/dhcp_release ${D}${bindir}
@@ -60,11 +66,12 @@ do_install () {
install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
fi
if [ "${@base_contains('PACKAGECONFIG', 'resolvconf', 'resolvconf', '', d)}" != "" ]; then
- install -d ${D}${sysconfdir}/resolvconf/update.d/
- install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
+ install -d ${D}${sysconfdir}/resolvconf/update.d/
+ install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
- install -d ${D}${sysconfdir}/default/volatiles
- install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
+ install -d ${D}${sysconfdir}/default/volatiles
+ install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
+ install -m 0755 ${WORKDIR}/dnsmasq-resolvconf-helper ${D}${bindir}
fi
}
diff --git a/meta-networking/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service
new file mode 100644
index 0000000000..cde2244c85
--- /dev/null
+++ b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=DNS forwarder and DHCP server
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/run/dnsmasq.pid
+ExecStartPre=/usr/bin/dnsmasq --test
+ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid
+ExecStop=/bin/kill $MAINPID
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper
new file mode 100644
index 0000000000..db54d467e6
--- /dev/null
+++ b/meta-networking/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
+
diff --git a/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service
new file mode 100644
index 0000000000..68b175c1fb
--- /dev/null
+++ b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=DNS forwarder and DHCP server
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/run/dnsmasq.pid
+ExecStartPre=/usr/bin/dnsmasq --test
+ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid
+ExecStartPost=/usr/bin/dnsmasq-resolvconf-helper start
+ExecStopPre=/usr/bin/dnsmasq-resolvconf-helper stop
+ExecStop=/bin/kill $MAINPID
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service b/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service
deleted file mode 100644
index c3637e142b..0000000000
--- a/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service
+++ /dev/null
@@ -1,16 +0,0 @@
-[Unit]
-Description=DNS forwarder and DHCP server
-After=network.target
-
-[Service]
-Type=forking
-PIDFile=/run/dnsmasq.pid
-ExecStartPre=/usr/sbin/dnsmasq --test
-ExecStart=/etc/init.d/dnsmasq systemd-exec
-ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
-ExecStopPre=/etc/init.d/dnsmasq systemd-stop-resolvconf
-ExecReload=/bin/kill -HUP $MAINPID
-
-[Install]
-WantedBy=multi-user.target
-