From: Harald Hoyer Date: Thu, 10 Mar 2011 14:55:02 +0000 (+0100) Subject: dracut: make options position independent X-Git-Tag: 009~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=486a1b9324d6fc7bc534d8147d64b8b259692c46;p=thirdparty%2Fdracut.git dracut: make options position independent now this is possible: $ dracut test.img -f $ dracut test.img '' -f --- diff --git a/dracut b/dracut index 8553774b1..e12882d61 100755 --- a/dracut +++ b/dracut @@ -111,6 +111,8 @@ read_arg() { fi } +kernel="unset" + while (($# > 0)); do case ${1%%=*} in -m|--modules) read_arg dracutmodules_l "$@" || shift;; @@ -151,10 +153,22 @@ while (($# > 0)); do do_list="yes"; ;; -*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;; - *) break ;; + *) + if ! [[ $outfile ]]; then + outfile=$1 + elif [[ $kernel = "unset" ]]; then + kernel=$1 + else + usage; exit 1; + fi + ;; esac shift done +if ! [[ $kernel ]] || [[ $kernel = "unset" ]]; then + kernel=$(uname -r) +fi +[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img" PATH=/sbin:/bin:/usr/sbin:/usr/bin export PATH @@ -256,8 +270,6 @@ case $dracutmodules in ""|auto) dracutmodules="all" ;; esac -[[ $2 ]] && kernel=$2 || kernel=$(uname -r) -[[ $1 ]] && outfile=$1 || outfile="/boot/initramfs-$kernel.img" abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile" srcmods="/lib/modules/$kernel/"