From: Harald Hoyer Date: Mon, 14 Sep 2009 17:33:54 +0000 (+0200) Subject: fix backwards inst() compat X-Git-Tag: 002~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=94dcc5b8d82a404915cd90c57876554237c807d4;p=thirdparty%2Fdracut.git fix backwards inst() compat --- diff --git a/dracut-functions b/dracut-functions index 65cd4cb1f..2abd6f2d5 100755 --- a/dracut-functions +++ b/dracut-functions @@ -260,15 +260,21 @@ inst_rules() { # general purpose installation function # Same args as above. inst() { - if (($# != 1 && $# != 2 && $# != 3 )); then - derror "inst only takes 1 or 2 or 3 arguments" - exit 1 - fi - if [[ $# = 3 ]]; then - [[ -z $initdir ]] && initdir=$2; - export initdir - set $1 $3 - fi + case $# in + 1) ;; + 2) + [[ -z $initdir ]] && [[ -d $2 ]] && export initdir=$2 + [[ $initdir = $2 ]] && set $1 + ;; + 3) + [[ -z $initdir ]] && export initdir=$2 + set $1 $3 + ;; + *) + derror "inst only takes 1 or 2 or 3 arguments" + exit 1 + ;; + esac for x in inst_symlink inst_script inst_binary inst_simple; do $x "$@" && return 0 done