watch /run/NetworkManager for creation of resolv.conf

Then copy it to persistent storage location which can be bind mounted
into images
This commit is contained in:
Bruce Leidl 2018-02-16 18:22:12 -05:00
parent 43b2077ae1
commit bf78fa6fd2
3 changed files with 21 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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}
}