Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dmsquash-live): correct regression introduced with shellcheck changes #1577

Merged
merged 1 commit into from
Oct 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions modules.d/90dmsquash-live/dmsquash-live-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,9 @@ do_live_overlay() {
# need to know where to look for the overlay
if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
mkdir -m 0755 -p /run/initramfs/overlayfs
opt=''
[ -n "$readonly_overlay" ] && opt=-r
mount -n -t auto "$devspec" /run/initramfs/overlayfs || :
if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
OVERLAY_LOOPDEV=$(losetup -f --show $opt /run/initramfs/overlayfs$pathspec)
OVERLAY_LOOPDEV=$(losetup -f --show ${readonly_overlay:+-r} /run/initramfs/overlayfs$pathspec)
over=$OVERLAY_LOOPDEV
umount -l /run/initramfs/overlayfs || :
oltype=$(det_img_fs "$OVERLAY_LOOPDEV")
Expand All @@ -148,11 +146,11 @@ do_live_overlay() {
fi
setup="yes"
else
mount -n -t "$oltype" $opt "$OVERLAY_LOOPDEV" /run/initramfs/overlayfs
mount -n -t "$oltype" ${readonly_overlay:+-r} "$OVERLAY_LOOPDEV" /run/initramfs/overlayfs
if [ -d /run/initramfs/overlayfs/overlayfs ] \
&& [ -d /run/initramfs/overlayfs/ovlwork ]; then
ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs$opt
ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork$opt
ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs${readonly_overlay:+-r}
ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork${readonly_overlay:+-r}
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
Expand All @@ -162,8 +160,8 @@ do_live_overlay() {
fi
elif [ -d /run/initramfs/overlayfs$pathspec ] \
&& [ -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
ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs${readonly_overlay:+-r}
ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork${readonly_overlay:+-r}
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
Expand Down Expand Up @@ -336,13 +334,13 @@ if [ -n "$FSIMG" ]; then
fi
FSIMG=/run/initramfs/fsimg/rootfs.img
fi
opt=-r
# For writable DM images...
readonly_base=1
if [ -z "$SQUASHED" -a -n "$live_ram" -a -z "$overlayfs" ] \
|| [ -n "$writable_fsimg" ] \
|| [ "$overlay" = none -o "$overlay" = None -o "$overlay" = NONE ]; then
if [ -z "$readonly_overlay" ]; then
opt=''
unset readonly_base
setup=rw
else
setup=yes
Expand All @@ -351,7 +349,7 @@ if [ -n "$FSIMG" ]; then
if [ "$FSIMG" = "$SQUASHED" ]; then
BASE_LOOPDEV=$SQUASHED_LOOPDEV
else
BASE_LOOPDEV=$(losetup -f --show "$opt" $FSIMG)
BASE_LOOPDEV=$(losetup -f --show ${readonly_base:+-r} $FSIMG)
sz=$(blockdev --getsz "$BASE_LOOPDEV")
fi
if [ "$setup" = rw ]; then
Expand Down