postmarketos-initramfs: fix partition cmdline priority (MR 4487)
The "pmos_[br]oot(_uuid)?" kernel cmdline args can be used to specify how to mount the root and boot partitions. During a previous rework, the behaviour of these was made inconsistent (becoming dependent on the order they were specified on the cmdline). Undo the previous "optimisation" by splitting them back out into two FOR loops, where the _uuid variants take precedence.
This commit is contained in:
parent
2c2aeed034
commit
5c6f2dd0d9
1 changed files with 28 additions and 16 deletions
|
@ -181,6 +181,10 @@ find_root_partition() {
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$PMOS_ROOT" ]; then
|
||||||
|
for x in $(cat /proc/cmdline); do
|
||||||
if ! [ "$x" = "${x#pmos_root=}" ]; then
|
if ! [ "$x" = "${x#pmos_root=}" ]; then
|
||||||
path="${x#pmos_root=}"
|
path="${x#pmos_root=}"
|
||||||
if [ -e "$path" ]; then
|
if [ -e "$path" ]; then
|
||||||
|
@ -189,6 +193,7 @@ find_root_partition() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# On-device installer: before postmarketOS is installed,
|
# On-device installer: before postmarketOS is installed,
|
||||||
# we want to use the installer partition as root. It is the
|
# we want to use the installer partition as root. It is the
|
||||||
|
@ -244,7 +249,13 @@ find_boot_partition() {
|
||||||
PMOS_BOOT="$path"
|
PMOS_BOOT="$path"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
elif ! [ "$x" = "${x#pmos_boot=}" ]; then
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$PMOS_BOOT" ]; then
|
||||||
|
# shellcheck disable=SC2013
|
||||||
|
for x in $(cat /proc/cmdline); do
|
||||||
|
if ! [ "$x" = "${x#pmos_boot=}" ]; then
|
||||||
# If the boot partition is specified explicitly
|
# If the boot partition is specified explicitly
|
||||||
# then we need to check if it's a valid path, and
|
# then we need to check if it's a valid path, and
|
||||||
# fall back if not...
|
# fall back if not...
|
||||||
|
@ -255,6 +266,7 @@ find_boot_partition() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Finally fall back to findfs by label
|
# Finally fall back to findfs by label
|
||||||
if [ -z "$PMOS_BOOT" ]; then
|
if [ -z "$PMOS_BOOT" ]; then
|
||||||
|
|
Loading…
Reference in a new issue