From bcc5a38b9849411a880d8b65771b30042aa7ce62 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Sat, 23 May 2009 06:48:09 +0000 Subject: init: improbe boot param parsing We need to support things like acpi_osi="!Windows 2006" --- initramfs-init.in | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/initramfs-init.in b/initramfs-init.in index 572d0e2..f8827a0 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -98,18 +98,22 @@ unpack_apkovl() { # gotta start from somewhere :) echo "Alpine Init $VERSION" -# read the kernel options -for i in `cat /proc/cmdline` ; do - case $i in +# read the kernel options. We use eval set so we can handle things like +# acpi_osi="!Windows 2006" +eval set -- `cat /proc/cmdline` + +while [ $# -gt 0 ]; do + case "$1" in s|single|1) SINGLEMODE=yes ;; modules=*) - MODULES="`echo ${i#modules=} | tr ',' ' '`";; + MODULES="`echo ${1#modules=} | tr ',' ' '`";; noautodetect) AUTODETECT=no;; - *=*) eval KOPT_$i ;; - *) eval KOPT_$i=yes ;; + *=*) eval "KOPT_${1%%=*}='${1#*=}'" ;; + *) eval "KOPT_$(echo $1 | sed 's: :_:g')=yes" ;; esac + shift done # start bootcharting if wanted -- cgit v1.2.3