Skip to content

Commit

Permalink
Fixed argument processing of config.bootoptions
Browse files Browse the repository at this point in the history
Instead of adding an extra space to make the subsequent reading
to work, use an awk script that does it without nasty workarounds
  • Loading branch information
schaefi committed Oct 16, 2023
1 parent b0fb1a7 commit 91189f9
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ 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 |\
awk '{ for(i=1; i <= NF; i++) {print $i } }' /config.bootoptions |\
grep root= | cut -f2- -d=
)

[ -z "${root_uuid}" ] && exit 1
[ -z "${root_uuid}" ] && exit 2

{
echo "[Unit]"
Expand Down

0 comments on commit 91189f9

Please sign in to comment.