From f484b3e3db48123ce44666b54e2c297cac8b4fea Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 27 Feb 2013 09:12:01 +0000 Subject: init: improve kernel param parsing We only set KOPT_* for the args we actually use and ignore the rest. --- initramfs-init.in | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/initramfs-init.in b/initramfs-init.in index 3ff0f0a..6ea85aa 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -284,17 +284,28 @@ echo "Alpine Init $VERSION" # acpi_osi="!Windows 2006" eval set -- `cat /proc/cmdline` -while [ $# -gt 0 ]; do - case "$1" in - s|single|1) - SINGLEMODE=yes ;; - console=*) - CONSOLE="$CONSOLE ${1#console=}";; - *=*) eval "KOPT_${1%%=*}='${1#*=}'" ;; - no*) eval "KOPT_$(echo ${1#no} | sed 's: :_:g')=no" ;; - *) eval "KOPT_$(echo $1 | sed 's: :_:g')=yes" ;; +myopts="alpine_dev autodetect autoraid chart cryptroot debug_init dma init_args + keep_apk_new modules ovl_dev pkgs quiet root_size root usbdelay" + +for opt; do + case "$opt" in + s|single|1) + SINGLEMODE=yes + continue + ;; + console=*) + CONSOLE="$CONSOLE ${opt#console=}" + continue + ;; esac - shift + + for i in $myopts; do + case "$opt" in + $i=*) eval "KOPT_${i}='${opt#*=}'";; + $i) eval "KOPT_${i}=yes";; + no$i) eval "KOPT_${i}=no";; + esac + done done # enable debugging if requested -- cgit v1.2.3