diff options
Diffstat (limited to 'modules.d/dnbd3-rootfs/hooks')
-rwxr-xr-x | modules.d/dnbd3-rootfs/hooks/s3-mount-root.sh | 14 | ||||
-rwxr-xr-x | modules.d/dnbd3-rootfs/hooks/s3-write-fstab.sh | 15 |
2 files changed, 21 insertions, 8 deletions
diff --git a/modules.d/dnbd3-rootfs/hooks/s3-mount-root.sh b/modules.d/dnbd3-rootfs/hooks/s3-mount-root.sh index 2f5fc15f..78410fce 100755 --- a/modules.d/dnbd3-rootfs/hooks/s3-mount-root.sh +++ b/modules.d/dnbd3-rootfs/hooks/s3-mount-root.sh @@ -1,5 +1,6 @@ #!/bin/bash +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh # $NEWROOT source "/etc/openslx" cnt=0 @@ -14,23 +15,20 @@ done ret=99 if [ -n "$SLX_MOUNT_ROOT_OPTIONS" ]; then # Always prefer mount options mandated by server + echo "Mounting with provided options: $SLX_MOUNT_ROOT_OPTIONS" mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" $SLX_MOUNT_ROOT_OPTIONS ret=$? else # Let's guess it's ext4, tune for maximum performance as we don't care about recoverability - mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" -o data=writeback,barrier=0,commit=60,noinit_itable,discard,noatime + echo "Trying optimized ext4 mount options..." + mount -t ext4 "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" -o data=writeback,barrier=0,commit=60,noinit_itable,discard,noatime ret=$? if (( ret != 0 )); then # Just try with no options and hope for the best... + echo "Trying default mount with no options..." mount "$SLX_DNBD3_DEVICE_COW" "$NEWROOT" ret=$? fi fi -(( ret != 0 )) && exit $ret - -if ! [ -e "$NEWROOT/etc/fstab.keep" ] && ! grep -qF 'NODELETE' "$NEWROOT/etc/fstab"; then - echo "" > "$NEWROOT/etc/fstab" -fi - -exit 0 +exit $ret 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 |