dracut: fix boot on non-zfs-root systems

Simply prevent overwriting root until it needs to be overwritten.

Dracut could change this value before this module is called, but won't
change the kernel command line.

Reviewed-by: Andrew J. Hesford <ajh@sideband.org>
Signed-off-by: Toyam Cox <vaelatern@voidlinux.org>
Closes #13592
This commit is contained in:
Toyam Cox 2022-06-30 13:47:58 -04:00 committed by GitHub
parent 5a4dd3a262
commit eefe83eaa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -88,11 +88,11 @@ decode_root_args() {
return return
fi fi
root=$(getarg root=) xroot=$(getarg root=)
rootfstype=$(getarg rootfstype=) rootfstype=$(getarg rootfstype=)
# shellcheck disable=SC2249 # shellcheck disable=SC2249
case "$root" in case "$xroot" in
""|zfs|zfs:|zfs:AUTO) ""|zfs|zfs:|zfs:AUTO)
root=zfs:AUTO root=zfs:AUTO
rootfstype=zfs rootfstype=zfs
@ -100,7 +100,7 @@ decode_root_args() {
;; ;;
ZFS=*|zfs:*) ZFS=*|zfs:*)
root="${root#zfs:}" root="${xroot#zfs:}"
root="${root#ZFS=}" root="${root#ZFS=}"
root=$(echo "$root" | tr '+' ' ') root=$(echo "$root" | tr '+' ' ')
rootfstype=zfs rootfstype=zfs
@ -109,9 +109,9 @@ decode_root_args() {
esac esac
if [ "$rootfstype" = "zfs" ]; then if [ "$rootfstype" = "zfs" ]; then
case "$root" in case "$xroot" in
"") root=zfs:AUTO ;; "") root=zfs:AUTO ;;
*) root=$(echo "$root" | tr '+' ' ') ;; *) root=$(echo "$xroot" | tr '+' ' ') ;;
esac esac
return 0 return 0
fi fi