Mail archive
alpine-devel

Re: [alpine-devel] mkinitfs initramfs-init questions

From: Natanael Copa <ncopa_at_alpinelinux.org>
Date: Tue, 26 Feb 2013 22:20:40 +0100

On Tue, 26 Feb 2013 21:45:49 +0100
Natanael Copa <ncopa_at_alpinelinux.org> wrote:
 
> > 4. Code looks overcomplicated because there are
> > a) not many options to be parsed by initramfs-init
> > b) not all kernel options must be parsed by initramfs-init,
> > unknown options must be skipped (and errors as in #2 will not be
> > raised in the future)
>
> Agree. We should only fish out the options we actually use and don't
> bother about the rest.

How about this:
diff --git a/initramfs-init.in b/initramfs-init.in
index 6e1ebc1..60a0255 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
_at_@ -283,22 +283,23 @@ 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" ;;
+for opt in "$_at_"; do
+ case "$opt" in
+ s|single|1)
+ SINGLEMODE=yes ;;
+ console=*)
+ CONSOLE="$CONSOLE ${opt#console=}";;
+ debug_init)
+ set -x;;
+ alpine_dev|autodetect|autoraid|chart|cryptroot|debug_init|dma|init_args|keep_apk_new|modules|ovl_dev|pkgs|quiet|root_size|root|usbdelay)
+ case "$opt" in
+ *=*) eval "KOPT_${opt%%=*}='${opt#*=}'";;
+ no*) eval "KOPT_${opt#no}=no";;
+ *) eval "KOPT_$opt=yes";;
+ esac
         esac
- shift
 done
 
-# enable debugging if requested
-[ -n "$KOPT_debug_init" ] && set -x
-
 # pick first keymap if found
 for map in /etc/keymap/*; do
         if [ -f "$map" ]; then



-nc


---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Tue Feb 26 2013 - 22:20:40 UTC