diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh index 94794804..67fc88fa 100644 --- a/dracut-initramfs-restore.sh +++ b/dracut-initramfs-restore.sh @@ -40,4 +40,13 @@ else exit 1 fi +if [[ -d squash ]]; then + unsquashfs -no-xattrs -f -d . squash/root.img >/dev/null + if [ $? -ne 0 ]; then + echo "Squash module is enabled for this initramfs but failed to unpack squash/root.img" >&2 + rm -f -- /run/initramfs/shutdown + exit 1 + fi +fi + exit 0 diff --git a/dracut.sh b/dracut.sh index e706714e..3dc2adc0 100755 --- a/dracut.sh +++ b/dracut.sh @@ -1849,9 +1849,7 @@ if dracut_module_included "squash"; then done mv $initdir/init $initdir/init.stock - mv $initdir/shutdown $initdir/shutdown.stock ln -s squash/init.sh $initdir/init - ln -s squash/shutdown.sh $initdir/shutdown mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null diff --git a/modules.d/99squash/shutdown.sh b/modules.d/99squash/shutdown.sh deleted file mode 100755 index 535779f4..00000000 --- a/modules.d/99squash/shutdown.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -/squash/setup-squash.sh - -exec /shutdown.stock - -echo "Something went wrong when trying to start original shutdown executable!" -exit 1