]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(overlayfs): to allow overlay on top of network device (nfs)
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Thu, 30 Mar 2023 14:08:47 +0000 (14:08 +0000)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 31 Mar 2024 20:33:48 +0000 (16:33 -0400)
Execute mount-overlayfs later in the boot process as a pre-pivot
hook. The existing mount hook is skipped for network boot.

Without this change
`dracut  -a "overlayfs nfs"`
would not work as expected.

Improved the existing test case to test for this scenario.

modules.d/90overlayfs/module-setup.sh
test/TEST-20-NFS/client-init.sh

index df7ba6838ea9106be9b06119c1d81451fa602c52..dae2009352018b39bffbe5c948e43b5a471c2139 100755 (executable)
@@ -14,6 +14,7 @@ installkernel() {
 }
 
 install() {
-    inst_hook mount 01 "$moddir/mount-overlayfs.sh"
     inst_hook pre-mount 01 "$moddir/prepare-overlayfs.sh"
+    inst_hook mount 01 "$moddir/mount-overlayfs.sh"     # overlay on top of block device
+    inst_hook pre-pivot 10 "$moddir/mount-overlayfs.sh" # overlay on top of network device (e.g. nfs)
 }
index 061a2b15a5570ea8f2506ea76e2377dcff3a9945..2f04503e2998d569a1fd476ceebac7d85a83d1dd 100755 (executable)
@@ -24,6 +24,13 @@ while read -r dev _ fstype opts rest || [ -n "$dev" ]; do
     break
 done < /proc/mounts
 
+# fail the test of rd.live.overlay did not worked as expected
+if grep -qF 'rd.live.overlay' /proc/cmdline; then
+    if ! strstr "$(cat /proc/mounts)" LiveOS_rootfs; then
+        echo "nfs-FAIL" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
+    fi
+fi
+
 if [ "$fstype" = "nfs" -o "$fstype" = "nfs4" ]; then
 
     serverip=${dev%:*}