@@ -92,43 +92,30 @@ if [ -d $EFI_DIR ];then
fi
# populate bootparam environment
-for p in `cat /proc/cmdline`; do
- if [ -n "$quoted" ]; then
- p_rstripped=${p%\"}
- value="$value $p_rstripped"
- if [ "$p_rstripped" != "$p" ]; then
- # End of a opt="word1 word2..." parameter
- eval "bootparam_${quoted}=\"${value}\""
- unset quoted
- fi
- continue
- fi
-
- opt=`echo $p | cut -d'=' -f1`
- opt=`echo $opt | sed -e 'y/.-/__/'`
- if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then
- # opt parameter
- eval "bootparam_${opt}=true"
- else
- value="`echo $p | cut -d'=' -f2-`" # Option value
- value_lstripped=${value#\"}
- value_rstripped=${value%\"}
-
- if [ "$value_lstripped" != "$value" ] && [ "$value_rstripped" != "$value" ]; then
- # opt="value" parameter
- eval "bootparam_${opt}=${value_lstripped%\"}"
- continue
- fi
-
- if [ "$value_lstripped" != "$value" ]; then
- # Start of a opt="word1 word2..." parameter
- quoted=${opt}
- value=${value_lstripped}
- continue
- fi
- eval "bootparam_${opt}=\"${value}\""
- fi
-done
+while IFS= read -r token; do
+ case "$token" in
+ *=*)
+ opt="${token%%=*}"
+ value="${token#*=}"
+ ;;
+ *)
+ opt="$token"
+ value="true"
+ ;;
+ esac
+ export "bootparam_${opt}=${value}"
+done <<EOF
+$(sed -E '
+s/^(([^ "]*|"[^"]*"|")*) +/\1\
+/
+s/^"(.*)"$/\1/
+s/^([^=]*)="(.*)"/\1=\2/
+:k
+s/^([^=.-]*)[.-]/\1_/
+tk
+P
+D' /proc/cmdline)
+EOF
# use /dev with devtmpfs
if grep -q devtmpfs /proc/filesystems; then