From 9d96af116c0872bf198ea331187371eb2fc89979 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 31 Jul 2019 19:09:53 +0200 Subject: Add bugfix service for old connman to systemd-networkd Signed-off-by: Laurent Bonnans --- .../files/clean-connman-symlink.service | 11 +++++++++++ .../networkd-dhcp-conf/files/resolvconf-clean | 14 ++++++++++++++ .../networkd-dhcp-conf/networkd-dhcp-conf.bb | 22 +++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 recipes-connectivity/networkd-dhcp-conf/files/clean-connman-symlink.service create mode 100644 recipes-connectivity/networkd-dhcp-conf/files/resolvconf-clean (limited to 'recipes-connectivity') 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 @@ +[Unit] +Description=Clean up bogus symlinked resolv.conf +Before=network-pre.target +Wants=network-pre.target + +[Service] +Type=oneshot +ExecStart=/usr/sbin/resolvconf-clean + +[Install] +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 @@ +#!/bin/sh + +set -e + +if [ ! -L /etc/resolv.conf ]; then + exit 0 +fi + +# 'readlink -f' will fail if the symlink doesn't resolve to an existing path +if readlink /etc/resolv.conf | grep -q connman; then + echo "Replacing resolv.conf symlink: $(readlink /etc/resolv.conf) to /etc/resolv-conf.systemd" + rm /etc/resolv.conf + ln -s /etc/resolv-conf.systemd /etc/resolv.conf +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 RPROVIDES_${PN} = "virtual/network-configuration" -SRC_URI_append = " file://20-wired-dhcp.network" +SRC_URI = " \ + file://20-wired-dhcp.network \ + file://resolvconf-clean \ + file://clean-connman-symlink.service \ + " PR = "r1" RDEPENDS_${PN} = "systemd" +RCONFLICTS_${PN} = "connman" S = "${WORKDIR}" PACKAGE_ARCH = "${MACHINE_ARCH}" -FILES_${PN} = "${systemd_unitdir}/network/*" +FILES_${PN} = " \ + ${systemd_unitdir}/network/* \ + ${sbindir}/resolvconf-clean \ + ${systemd_unitdir}/system/clean-connman-symlink.service \ + " + +SYSTEMD_SERVICE_${PN} = "clean-connman-symlink.service" DEV_MATCH_DIRECTIVE ?= "Name=en*" do_install() { install -d ${D}/${systemd_unitdir}/network - install -m 0644 ${WORKDIR}/20-wired-dhcp.network ${D}/${systemd_unitdir}/network + install -m 0644 ${WORKDIR}/20-wired-dhcp.network ${D}${systemd_unitdir}/network sed -i -e 's|@MATCH_DIRECTIVE@|${DEV_MATCH_DIRECTIVE}|g' ${D}${systemd_unitdir}/network/20-wired-dhcp.network + + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/resolvconf-clean ${D}${sbindir}/resolvconf-clean + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/clean-connman-symlink.service ${D}${systemd_unitdir}/system/clean-connman-symlink.service } -- cgit v1.2.3-54-g00ecf