From 94dcc5b8d82a404915cd90c57876554237c807d4 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 14 Sep 2009 19:33:54 +0200 Subject: [PATCH] fix backwards inst() compat --- dracut-functions | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/dracut-functions b/dracut-functions index 65cd4cb1..2abd6f2d 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