fix backwards inst() compat
authorHarald Hoyer <harald@redhat.com>
Mon, 14 Sep 2009 17:33:54 +0000 (19:33 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 14 Sep 2009 17:33:54 +0000 (19:33 +0200)
dracut-functions

index 65cd4cb..2abd6f2 100755 (executable)
@@ -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