diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-02-27 09:12:01 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-02-27 12:50:39 +0000 |
commit | f484b3e3db48123ce44666b54e2c297cac8b4fea (patch) | |
tree | 99e01fe07a9c59652419d96d9fbf56c5c539e376 | |
parent | 7610f39218f20a0d9dc207174cae51008a189016 (diff) | |
download | mkinitfs-f484b3e3db48123ce44666b54e2c297cac8b4fea.tar.bz2 mkinitfs-f484b3e3db48123ce44666b54e2c297cac8b4fea.tar.xz |
init: improve kernel param parsing
We only set KOPT_* for the args we actually use and ignore the rest.
-rwxr-xr-x | initramfs-init.in | 31 |
1 files 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 |