Fixed nasty bug in ramdisk generator

The ramdisk unit generator reads the config.bootoptions
file and extracts the root_uuid from it. This is done
with a very simple shell read using a space as separator.
However the last element is never read by that code.
As long as there was yet another kernel cmdline option
after the root= option this bug was not an issue. But
as soon as the root= option is last in the list it will
not be read and the generator exits prior creating the
sysroot.mount target. This commit fixes it in a way
that it makes sure there is always a space at the end
of the config.bootoptions file
This commit is contained in:
Marcus Schäfer 2021-10-22 17:38:27 +02:00
parent 2547257cce
commit df4e62a4e2
No known key found for this signature in database
GPG Key ID: AD11DD02B44996EF

View File

@ -26,6 +26,10 @@ GENERATOR_DIR="$1"
[ -e /config.bootoptions ] || exit 1
# Add a space to /config.bootoptions to make sure the
# following token based read captures all entries
echo -n ' ' >> /config.bootoptions
root_uuid=$(
while read -r -d ' ' opt; do echo "${opt}";done < /config.bootoptions |\
grep root= | cut -f2- -d=