From 50a0abd011d87c57ea2e4d93f0a2221a534d5f40 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Fri, 10 Jul 2020 16:31:30 +0200 Subject: nfs-utils: fix nfs systemd daemons runtime issues nfs-mountd.service and nfs-statd.service rely on /var/lib/nfs to be present in rootfs, or else they would run into problems for some files missing in it. But a ostree/ota rootfs does not have that directory (removed during do_image), to fix that, we now copy them to /var/local/lib/nfs and mount it to /var/lib/nfs at runtime, which is done in nfs-home-mount.service. nfs-mountd.service and nfs-statd.service need run after nfs-home-mount.service. Signed-off-by: Ming Liu --- .../nfs-utils/nfs-utils/nfs-home-mount.service | 13 +++++++++++ .../nfs-utils/nfs-utils_%.bbappend | 25 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 recipes-connectivity/nfs-utils/nfs-utils/nfs-home-mount.service create mode 100644 recipes-connectivity/nfs-utils/nfs-utils_%.bbappend diff --git a/recipes-connectivity/nfs-utils/nfs-utils/nfs-home-mount.service b/recipes-connectivity/nfs-utils/nfs-utils/nfs-home-mount.service new file mode 100644 index 0000000..514151a --- /dev/null +++ b/recipes-connectivity/nfs-utils/nfs-utils/nfs-home-mount.service @@ -0,0 +1,13 @@ +[Unit] +Description=NFS home mount @LOCALSTATEDIR@/local/lib/nfs -> @LOCALSTATEDIR@/lib/nfs. +DefaultDependencies=no +Conflicts=umount.target +After=local-fs.target + +[Service] +ExecStartPre=@BASE_BINDIR@/mkdir -p @LOCALSTATEDIR@/lib/nfs +ExecStart=@BASE_BINDIR@/mount -o bind @LOCALSTATEDIR@/local/lib/nfs @LOCALSTATEDIR@/lib/nfs +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/recipes-connectivity/nfs-utils/nfs-utils_%.bbappend b/recipes-connectivity/nfs-utils/nfs-utils_%.bbappend new file mode 100644 index 0000000..2304ab4 --- /dev/null +++ b/recipes-connectivity/nfs-utils/nfs-utils_%.bbappend @@ -0,0 +1,25 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +SRC_URI += "file://nfs-home-mount.service" + +SYSTEMD_SERVICE_${PN} += "nfs-home-mount.service" + +CONFFILES_${PN}-client += "${localstatedir}/local/lib" + +do_install_append_sota () { + install -d ${D}${localstatedir}/local + cp -aPR ${D}${localstatedir}/lib ${D}${localstatedir}/local + + install -m 0644 ${WORKDIR}/nfs-home-mount.service ${D}${systemd_unitdir}/system/ + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ + ${D}${systemd_unitdir}/system/nfs-home-mount.service + + sed -i -e '0,/Requires=/{s,Requires=\(.*\),Requires=\1 nfs-home-mount.service,}' \ + -e '0,/After=/{s,After=\(.*\),After=\1 nfs-home-mount.service,}' \ + ${D}${systemd_unitdir}/system/nfs-statd.service + + sed -i -e '0,/Requires=/{s,Requires=\(.*\),Requires=\1 nfs-home-mount.service,}' \ + -e '0,/After=/{s,After=\(.*\),After=\1 nfs-home-mount.service,}' \ + ${D}${systemd_unitdir}/system/nfs-mountd.service +} -- cgit v1.2.3-54-g00ecf From 3fec6c00f3feba92c3a8f7f75f7b0a265f38d58e Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Sun, 26 Jul 2020 11:41:25 +0200 Subject: nfs-utils: don't add nfs-home-mount.service without sota enabled * nfs-home-mount.service is installed by do_install_append_sota, so only when sota is enabled but it was always added to SYSTEMD_SERVICE_ even when sota wasn't enabled resulting in do_patch failure: nfs-utils-2.5.1-r0 do_package: SYSTEMD_SERVICE_nfs-utils value nfs-home-mount.service does not exist * use sota override everywhere Signed-off-by: Martin Jansa --- recipes-connectivity/nfs-utils/nfs-utils_%.bbappend | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes-connectivity/nfs-utils/nfs-utils_%.bbappend b/recipes-connectivity/nfs-utils/nfs-utils_%.bbappend index 2304ab4..7cce775 100644 --- a/recipes-connectivity/nfs-utils/nfs-utils_%.bbappend +++ b/recipes-connectivity/nfs-utils/nfs-utils_%.bbappend @@ -1,10 +1,10 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" +FILESEXTRAPATHS_prepend_sota := "${THISDIR}/${BPN}:" -SRC_URI += "file://nfs-home-mount.service" +SRC_URI_append_sota = " file://nfs-home-mount.service" -SYSTEMD_SERVICE_${PN} += "nfs-home-mount.service" +SYSTEMD_SERVICE_${PN}_append_sota = " nfs-home-mount.service" -CONFFILES_${PN}-client += "${localstatedir}/local/lib" +CONFFILES_${PN}-client_append_sota = " ${localstatedir}/local/lib" do_install_append_sota () { install -d ${D}${localstatedir}/local -- cgit v1.2.3-54-g00ecf