From 44d1688164040f088fd66fb8a2d458e1f61836ce Mon Sep 17 00:00:00 2001 From: Frederick Grose Date: Mon, 3 Sep 2018 19:02:23 -0400 Subject: [PATCH] dmsquash-live-root: Manage absent overlayfs module better. die when required; systemctl reload otherwise. --- modules.d/90dmsquash-live/dmsquash-live-root.sh | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh index 330ba3e9..6324fe83 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh @@ -146,10 +146,10 @@ do_live_overlay() { [ -d /run/initramfs/overlayfs/ovlwork ]; then ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs$opt ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork$opt - if [ -z "$overlayfs" ]; then - overlayfs="yes" - [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;" + if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then + reloadsysrootmountunit=":>/xor_overlayfs;" fi + overlayfs="required" setup="yes" fi fi @@ -157,18 +157,24 @@ do_live_overlay() { [ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs$opt ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork$opt - if [ -z "$overlayfs" ]; then - overlayfs="yes" - [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;" + if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then + reloadsysrootmountunit=":>/xor_overlayfs;" fi + overlayfs="required" setup="yes" fi fi if [ -n "$overlayfs" ]; then modprobe overlay if [ $? != 0 ]; then + if [ "$overlayfs" = required ]; then + die "OverlayFS is required but not available." + exit 1 + fi + [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;" m='OverlayFS is not available; using temporary Device-mapper overlay.' - unset -v overlayfs setup reloadsysrootmountunit + info $m + unset -v overlayfs setup fi fi @@ -302,10 +308,10 @@ if [ -e "$SQUASHED" ]; then fi elif [ -d /run/initramfs/squashfs/proc ]; then FSIMG=$SQUASHED - if [ -z "$overlayfs" ]; then - overlayfs="yes" - [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;" + if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then + reloadsysrootmountunit=":>/xor_overlayfs;" fi + overlayfs="required" else die "Failed to find a root filesystem in $SQUASHED." exit 1