diff options
3 files changed, 44 insertions, 3 deletions
diff --git a/recipes-connectivity/networkd-dhcp-conf/files/clean-connman-symlink.service b/recipes-connectivity/networkd-dhcp-conf/files/clean-connman-symlink.service new file mode 100644 index 0000000..8af8263 --- /dev/null +++ b/recipes-connectivity/networkd-dhcp-conf/files/clean-connman-symlink.service | |||
@@ -0,0 +1,11 @@ | |||
1 | [Unit] | ||
2 | Description=Clean up bogus symlinked resolv.conf | ||
3 | Before=network-pre.target | ||
4 | Wants=network-pre.target | ||
5 | |||
6 | [Service] | ||
7 | Type=oneshot | ||
8 | ExecStart=/usr/sbin/resolvconf-clean | ||
9 | |||
10 | [Install] | ||
11 | WantedBy=multi-user.target | ||
diff --git a/recipes-connectivity/networkd-dhcp-conf/files/resolvconf-clean b/recipes-connectivity/networkd-dhcp-conf/files/resolvconf-clean new file mode 100644 index 0000000..89c7e90 --- /dev/null +++ b/recipes-connectivity/networkd-dhcp-conf/files/resolvconf-clean | |||
@@ -0,0 +1,14 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | set -e | ||
4 | |||
5 | if [ ! -L /etc/resolv.conf ]; then | ||
6 | exit 0 | ||
7 | fi | ||
8 | |||
9 | # 'readlink -f' will fail if the symlink doesn't resolve to an existing path | ||
10 | if readlink /etc/resolv.conf | grep -q connman; then | ||
11 | echo "Replacing resolv.conf symlink: $(readlink /etc/resolv.conf) to /etc/resolv-conf.systemd" | ||
12 | rm /etc/resolv.conf | ||
13 | ln -s /etc/resolv-conf.systemd /etc/resolv.conf | ||
14 | fi | ||
diff --git a/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb b/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb index 0700ac6..b6076cd 100644 --- a/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb +++ b/recipes-connectivity/networkd-dhcp-conf/networkd-dhcp-conf.bb | |||
@@ -8,21 +8,37 @@ inherit allarch systemd | |||
8 | 8 | ||
9 | RPROVIDES_${PN} = "virtual/network-configuration" | 9 | RPROVIDES_${PN} = "virtual/network-configuration" |
10 | 10 | ||
11 | SRC_URI_append = " file://20-wired-dhcp.network" | 11 | SRC_URI = " \ |
12 | file://20-wired-dhcp.network \ | ||
13 | file://resolvconf-clean \ | ||
14 | file://clean-connman-symlink.service \ | ||
15 | " | ||
12 | PR = "r1" | 16 | PR = "r1" |
13 | 17 | ||
14 | RDEPENDS_${PN} = "systemd" | 18 | RDEPENDS_${PN} = "systemd" |
19 | RCONFLICTS_${PN} = "connman" | ||
15 | 20 | ||
16 | S = "${WORKDIR}" | 21 | S = "${WORKDIR}" |
17 | 22 | ||
18 | PACKAGE_ARCH = "${MACHINE_ARCH}" | 23 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
19 | 24 | ||
20 | FILES_${PN} = "${systemd_unitdir}/network/*" | 25 | FILES_${PN} = " \ |
26 | ${systemd_unitdir}/network/* \ | ||
27 | ${sbindir}/resolvconf-clean \ | ||
28 | ${systemd_unitdir}/system/clean-connman-symlink.service \ | ||
29 | " | ||
30 | |||
31 | SYSTEMD_SERVICE_${PN} = "clean-connman-symlink.service" | ||
21 | 32 | ||
22 | DEV_MATCH_DIRECTIVE ?= "Name=en*" | 33 | DEV_MATCH_DIRECTIVE ?= "Name=en*" |
23 | 34 | ||
24 | do_install() { | 35 | do_install() { |
25 | install -d ${D}/${systemd_unitdir}/network | 36 | install -d ${D}/${systemd_unitdir}/network |
26 | install -m 0644 ${WORKDIR}/20-wired-dhcp.network ${D}/${systemd_unitdir}/network | 37 | install -m 0644 ${WORKDIR}/20-wired-dhcp.network ${D}${systemd_unitdir}/network |
27 | sed -i -e 's|@MATCH_DIRECTIVE@|${DEV_MATCH_DIRECTIVE}|g' ${D}${systemd_unitdir}/network/20-wired-dhcp.network | 38 | sed -i -e 's|@MATCH_DIRECTIVE@|${DEV_MATCH_DIRECTIVE}|g' ${D}${systemd_unitdir}/network/20-wired-dhcp.network |
39 | |||
40 | install -d ${D}${sbindir} | ||
41 | install -m 0755 ${WORKDIR}/resolvconf-clean ${D}${sbindir}/resolvconf-clean | ||
42 | install -d ${D}${systemd_unitdir}/system | ||
43 | install -m 0644 ${WORKDIR}/clean-connman-symlink.service ${D}${systemd_unitdir}/system/clean-connman-symlink.service | ||
28 | } | 44 | } |