summaryrefslogtreecommitdiffstats
path: root/meta-networking
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
parentabd1795729501a13608da67054b9cbf185404be3 (diff)
downloadmeta-openembedded-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')
-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 622e63067..cc7f9e3be 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 \
10SRC_URI = "http://www.thekelleys.org.uk/dnsmasq/${@['archive/', ''][float(d.getVar('PV',1).split('.')[1]) > 15]}dnsmasq-${PV}.tar.gz;name=dnsmasq-${PV} \ 10SRC_URI = "http://www.thekelleys.org.uk/dnsmasq/${@['archive/', ''][float(d.getVar('PV',1).split('.')[1]) > 15]}dnsmasq-${PV}.tar.gz;name=dnsmasq-${PV} \
11 file://init \ 11 file://init \
12 file://dnsmasq.conf \ 12 file://dnsmasq.conf \
13 file://dnsmasq.service \ 13 file://dnsmasq-resolvconf.service \
14 file://dnsmasq-noresolvconf.service \
14" 15"
15 16
16inherit pkgconfig update-rc.d systemd 17inherit pkgconfig update-rc.d systemd
@@ -33,7 +34,7 @@ EXTRA_OEMAKE = "\
33 'LDFLAGS=${LDFLAGS}' \ 34 'LDFLAGS=${LDFLAGS}' \
34" 35"
35 36
36SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq', '', d)}" 37SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'resolvconf', 'file://dnsmasq.resolvconf file://99_dnsmasq file://dnsmasq-resolvconf-helper', '', d)}"
37 38
38do_compile_append() { 39do_compile_append() {
39 # build dhcp_release 40 # build dhcp_release
@@ -51,7 +52,12 @@ do_install () {
51 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/dnsmasq 52 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/dnsmasq
52 53
53 install -d ${D}${systemd_unitdir}/system 54 install -d ${D}${systemd_unitdir}/system
54 install -m 0644 ${WORKDIR}/dnsmasq.service ${D}${systemd_unitdir}/system 55
56 if [ "${@base_contains('PACKAGECONFIG', 'resolvconf', 'resolvconf', '', d)}" != "" ]; then
57 install -m 0644 ${WORKDIR}/dnsmasq-resolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
58 else
59 install -m 0644 ${WORKDIR}/dnsmasq-noresolvconf.service ${D}${systemd_unitdir}/system/dnsmasq.service
60 fi
55 61
56 install -m 0755 ${S}/contrib/wrt/dhcp_release ${D}${bindir} 62 install -m 0755 ${S}/contrib/wrt/dhcp_release ${D}${bindir}
57 63
@@ -60,11 +66,12 @@ do_install () {
60 install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/ 66 install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
61 fi 67 fi
62 if [ "${@base_contains('PACKAGECONFIG', 'resolvconf', 'resolvconf', '', d)}" != "" ]; then 68 if [ "${@base_contains('PACKAGECONFIG', 'resolvconf', 'resolvconf', '', d)}" != "" ]; then
63 install -d ${D}${sysconfdir}/resolvconf/update.d/ 69 install -d ${D}${sysconfdir}/resolvconf/update.d/
64 install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq 70 install -m 0755 ${WORKDIR}/dnsmasq.resolvconf ${D}${sysconfdir}/resolvconf/update.d/dnsmasq
65 71
66 install -d ${D}${sysconfdir}/default/volatiles 72 install -d ${D}${sysconfdir}/default/volatiles
67 install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles 73 install -m 0644 ${WORKDIR}/99_dnsmasq ${D}${sysconfdir}/default/volatiles
74 install -m 0755 ${WORKDIR}/dnsmasq-resolvconf-helper ${D}${bindir}
68 fi 75 fi
69} 76}
70 77
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 000000000..cde2244c8
--- /dev/null
+++ b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-noresolvconf.service
@@ -0,0 +1,15 @@
1[Unit]
2Description=DNS forwarder and DHCP server
3After=network.target
4
5[Service]
6Type=forking
7PIDFile=/run/dnsmasq.pid
8ExecStartPre=/usr/bin/dnsmasq --test
9ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid
10ExecStop=/bin/kill $MAINPID
11ExecReload=/bin/kill -HUP $MAINPID
12
13[Install]
14WantedBy=multi-user.target
15
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 000000000..db54d467e
--- /dev/null
+++ b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf-helper
@@ -0,0 +1,62 @@
1#!/bin/bash
2#
3# Borrowing heavily from the dnsmasq initscript's version of support for
4# resolvconf, intended for use in systemd-only configurations.
5#
6PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
7DAEMON=/usr/sbin/dnsmasq
8NAME=dnsmasq
9
10# Most configuration options in /etc/default/dnsmasq are deprecated
11# but still honoured.
12if [ -r /etc/default/$NAME ]; then
13 . /etc/default/$NAME
14fi
15
16start_resolvconf()
17{
18 # If interface "lo" is explicitly disabled in /etc/default/dnsmasq
19 # Then dnsmasq won't be providing local DNS, so don't add it to
20 # the resolvconf server set.
21 for interface in $DNSMASQ_EXCEPT
22 do
23 [ $interface = lo ] && return
24 done
25
26 if [ -x /sbin/resolvconf ] ; then
27 echo "nameserver 127.0.0.1" |
28 /sbin/resolvconf -a lo.$NAME
29 fi
30 return 0
31}
32
33stop_resolvconf()
34{
35 if [ -x /sbin/resolvconf ] ; then
36 /sbin/resolvconf -d lo.$NAME
37 fi
38 return 0
39}
40
41case "$1" in
42 start)
43 start_resolvconf
44 exit 0
45 ;;
46 stop)
47 stop_resolvconf
48 exit 0
49 ;;
50 restart)
51 stop_resolvconf
52 start_resolvconf
53 exit 0
54 ;;
55 *)
56 echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2
57 exit 3
58 ;;
59esac
60
61exit 0
62
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 000000000..68b175c1f
--- /dev/null
+++ b/meta-networking/recipes-support/dnsmasq/files/dnsmasq-resolvconf.service
@@ -0,0 +1,17 @@
1[Unit]
2Description=DNS forwarder and DHCP server
3After=network.target
4
5[Service]
6Type=forking
7PIDFile=/run/dnsmasq.pid
8ExecStartPre=/usr/bin/dnsmasq --test
9ExecStart=/usr/bin/dnsmasq -x /run/dnsmasq.pid
10ExecStartPost=/usr/bin/dnsmasq-resolvconf-helper start
11ExecStopPre=/usr/bin/dnsmasq-resolvconf-helper stop
12ExecStop=/bin/kill $MAINPID
13ExecReload=/bin/kill -HUP $MAINPID
14
15[Install]
16WantedBy=multi-user.target
17
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 c3637e142..000000000
--- a/meta-networking/recipes-support/dnsmasq/files/dnsmasq.service
+++ /dev/null
@@ -1,16 +0,0 @@
1[Unit]
2Description=DNS forwarder and DHCP server
3After=network.target
4
5[Service]
6Type=forking
7PIDFile=/run/dnsmasq.pid
8ExecStartPre=/usr/sbin/dnsmasq --test
9ExecStart=/etc/init.d/dnsmasq systemd-exec
10ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf
11ExecStopPre=/etc/init.d/dnsmasq systemd-stop-resolvconf
12ExecReload=/bin/kill -HUP $MAINPID
13
14[Install]
15WantedBy=multi-user.target
16