From bf78fa6fd2bbbebdce8264177bf4a5b22c9f0102 Mon Sep 17 00:00:00 2001 From: Bruce Leidl Date: Fri, 16 Feb 2018 18:22:12 -0500 Subject: [PATCH] watch /run/NetworkManager for creation of resolv.conf Then copy it to persistent storage location which can be bind mounted into images --- .../networkmanager/files/watch-resolvconf.path | 10 ++++++++++ .../networkmanager/files/watch-resolvconf.service | 7 +++++++ .../networkmanager/networkmanager.inc | 5 ++++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.path create mode 100644 meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.service diff --git a/meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.path b/meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.path new file mode 100644 index 0000000..4f7fbaf --- /dev/null +++ b/meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.path @@ -0,0 +1,10 @@ +[Unit] +Description=Watch /run/NetworkManager + +[Path] +PathExists=/run/NetworkManager/resolv.conf +PathChanged=/run/NetworkManager +MakeDirectory=true + +[Install] +WantedBy=multi-user.target diff --git a/meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.service b/meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.service new file mode 100644 index 0000000..d4d1aab --- /dev/null +++ b/meta-citadel/recipes-connectivity/networkmanager/files/watch-resolvconf.service @@ -0,0 +1,7 @@ +[Unit] +Description=Copy resolv.conf to /storage/citadel-state +ConditionPathExists=/run/NetworkManager/resolv.conf +ConditionPathExists=/storage/citadel-state +[Service] +Type=oneshot +ExecStart=/bin/cp /run/NetworkManager/resolv.conf /storage/citadel-state/resolv.conf diff --git a/meta-citadel/recipes-connectivity/networkmanager/networkmanager.inc b/meta-citadel/recipes-connectivity/networkmanager/networkmanager.inc index bb69d08..3304b2b 100644 --- a/meta-citadel/recipes-connectivity/networkmanager/networkmanager.inc +++ b/meta-citadel/recipes-connectivity/networkmanager/networkmanager.inc @@ -15,6 +15,7 @@ export GI_TYPELIB_PATH = "${STAGING_LIBDIR_NATIVE}/girepository-1.0" inherit gnomebase gettext systemd bluetooth gobject-introspection upstream-version-is-even python3native gtk-doc SRC_URI = "${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \ + file://watch-resolvconf.path file://watch-resolvconf.service \ " S = "${WORKDIR}/NetworkManager-${PV}" @@ -118,8 +119,10 @@ FILES_${PN}-nmtui-doc = " \ ${mandir}/man1/nmtui* \ " -SYSTEMD_SERVICE_${PN} = "NetworkManager.service NetworkManager-dispatcher.service" +SYSTEMD_SERVICE_${PN} = "NetworkManager.service NetworkManager-dispatcher.service watch-resolvconf.path" do_install_append() { rm -rf ${D}/run ${D}${localstatedir}/run + install -m 644 ${WORKDIR}/watch-resolvconf.path ${D}${systemd_system_unitdir} + install -m 644 ${WORKDIR}/watch-resolvconf.service ${D}${systemd_system_unitdir} }