90-loaderentry.install: fixup BOOT_OPTIONS
authorHarald Hoyer <harald@redhat.com>
Mon, 1 Jun 2015 09:28:03 +0000 (11:28 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 2 Jun 2015 14:10:06 +0000 (16:10 +0200)
better use "read -r -d '' -a" to read in the array. It handles multiple
lines and missing newline at the EOF.

src/kernel-install/90-loaderentry.install

index d433e00..4c9b1f0 100644 (file)
@@ -43,14 +43,14 @@ fi
 declare -a BOOT_OPTIONS
 
 if [[ -f /etc/kernel/cmdline ]]; then
-    readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
+    read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
 fi
 
 if ! [[ ${BOOT_OPTIONS[*]} ]]; then
-    read -a line -r < /proc/cmdline
+    read -r -d '' -a line < /proc/cmdline
     for i in "${line[@]}"; do
         [[ "${i#initrd=*}" != "$i" ]] && continue
-        BOOT_OPTIONS[${#BOOT_OPTIONS[@]}]="$i"
+        BOOT_OPTIONS+=("$i")
     done
 fi