summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Liu <ming.liu@toradex.com>2020-07-10 16:31:30 +0200
committerMing Liu <ming.liu@toradex.com>2020-08-11 10:26:19 +0200
commit50a0abd011d87c57ea2e4d93f0a2221a534d5f40 (patch)
tree78c90470d7b2eb58694ef37bc2155a4b92c1c6bb
parent2e052e1c73cccf8a0e0cd73ee498c6fc146bcf42 (diff)
downloadmeta-updater-50a0abd011d87c57ea2e4d93f0a2221a534d5f40.tar.gz
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 <ming.liu@toradex.com>
-rw-r--r--recipes-connectivity/nfs-utils/nfs-utils/nfs-home-mount.service13
-rw-r--r--recipes-connectivity/nfs-utils/nfs-utils_%.bbappend25
2 files changed, 38 insertions, 0 deletions
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 @@
1[Unit]
2Description=NFS home mount @LOCALSTATEDIR@/local/lib/nfs -> @LOCALSTATEDIR@/lib/nfs.
3DefaultDependencies=no
4Conflicts=umount.target
5After=local-fs.target
6
7[Service]
8ExecStartPre=@BASE_BINDIR@/mkdir -p @LOCALSTATEDIR@/lib/nfs
9ExecStart=@BASE_BINDIR@/mount -o bind @LOCALSTATEDIR@/local/lib/nfs @LOCALSTATEDIR@/lib/nfs
10RemainAfterExit=yes
11
12[Install]
13WantedBy=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 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
2
3SRC_URI += "file://nfs-home-mount.service"
4
5SYSTEMD_SERVICE_${PN} += "nfs-home-mount.service"
6
7CONFFILES_${PN}-client += "${localstatedir}/local/lib"
8
9do_install_append_sota () {
10 install -d ${D}${localstatedir}/local
11 cp -aPR ${D}${localstatedir}/lib ${D}${localstatedir}/local
12
13 install -m 0644 ${WORKDIR}/nfs-home-mount.service ${D}${systemd_unitdir}/system/
14 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
15 -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
16 ${D}${systemd_unitdir}/system/nfs-home-mount.service
17
18 sed -i -e '0,/Requires=/{s,Requires=\(.*\),Requires=\1 nfs-home-mount.service,}' \
19 -e '0,/After=/{s,After=\(.*\),After=\1 nfs-home-mount.service,}' \
20 ${D}${systemd_unitdir}/system/nfs-statd.service
21
22 sed -i -e '0,/Requires=/{s,Requires=\(.*\),Requires=\1 nfs-home-mount.service,}' \
23 -e '0,/After=/{s,After=\(.*\),After=\1 nfs-home-mount.service,}' \
24 ${D}${systemd_unitdir}/system/nfs-mountd.service
25}