Skip to content

Commit

Permalink
fix(convertfs): shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
aafeijoo-suse committed Aug 5, 2024
1 parent 04fdcff commit 3178c3f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions modules.d/30convertfs/convertfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ while [[ $ROOT != "${ROOT%/}" ]]; do
done

#mount /sysroot rw
[ -w $ROOT ] || mount -o remount,rw $ROOT
[[ -w $ROOT ]] || mount -o remount,rw "$ROOT"

#mount /sysroot/var if it is a separate mount
VARDEV=$(sed -n -e 's/^\#.*//' -e '/ \/var /s/\([[:graph:]]* \).*/\1/p' "$ROOT"/etc/fstab)
VARFS=$(sed -n -e 's/^\#.*//' -e '/ \/var /s/[[:graph:]]* * [[:graph:]]* *\([[:graph:]]* \).*/\1/p' "$ROOT"/etc/fstab)

if [[ -n $VARDEV ]] && [[ -n $VARFS ]]; then
#mount btrfs subvolume var
if [ $VARFS == btrfs ]; then
SUBVOLIDVAR=$(btrfs subvolume list $ROOT | sed -n '/var$/s/ID \([[:digit:]]*\) .*/\1/p')
if [[ $VARFS == btrfs ]]; then
SUBVOLIDVAR=$(btrfs subvolume list "$ROOT" | sed -n '/var$/s/ID \([[:digit:]]*\) .*/\1/p')
ROOTDEV=$(sed -n "/\\$ROOT/s/\([[:graph:]]*\) .*/\1/p" /proc/mounts)
[ -z $SUBVOLIDVAR ] || mount -o subvolid=$SUBVOLIDVAR $ROOTDEV $ROOT/var
[[ -z $SUBVOLIDVAR ]] || mount -o subvolid="$SUBVOLIDVAR" "$ROOTDEV" "$ROOT"/var
else
mount $VARDEV $ROOT/var
mount "$VARDEV" "$ROOT"/var
fi
fi

Expand All @@ -50,8 +50,8 @@ if [ ! -L "$ROOT"/var/lock -a -e "$ROOT"/var/lock ]; then
ln -sfn ../run/lock "$ROOT"/var/lock
fi

[[ -n $SUBVOLIDVAR ]] && umount $ROOT/var
[ -w $ROOT ] && mount -o remount,ro $ROOT
[[ -n $SUBVOLIDVAR ]] && umount "$ROOT"/var
[[ -w $ROOT ]] && mount -o remount,ro "$ROOT"

echo "Done."
exit 0

0 comments on commit 3178c3f

Please sign in to comment.