summaryrefslogtreecommitdiffstats
path: root/modules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh
blob: 8cb252cd18d978f40ea017cba1be54583f6e6dd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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