summaryrefslogtreecommitdiffstats
path: root/modules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh')
-rwxr-xr-xmodules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh b/modules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh
new file mode 100755
index 00000000..8cb252cd
--- /dev/null
+++ b/modules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh # $NEWROOT
+
+if [ -e "/etc/fstab" ]; then
+ echo "Copying /etc/fstab from initrd"
+ cp -f "/etc/fstab" "$NEWROOT/etc/fstab" || exit 1
+elif ! [ -e "$NEWROOT/etc/fstab.keep" ] && ! grep -qF 'NODELETE' "$NEWROOT/etc/fstab"; then
+ echo "Wiping stage4 fstab"
+ echo "" > "$NEWROOT/etc/fstab" || exit 1
+else
+ echo "Keeping stage4 fstab untouched"
+fi
+
+exit 0