瀏覽代碼

create_instance script enhancement to fit with runtest bugfix

Yann Weber 8 年之前
父節點
當前提交
6e36af8094
共有 1 個檔案被更改,包括 16 行新增7 行删除
  1. 16
    7
      progs/create_instance.sh

+ 16
- 7
progs/create_instance.sh 查看文件

@@ -1,8 +1,8 @@
1 1
 #!/bin/bash
2 2
 
3 3
 usage() {
4
-	echo -e "Usage : $0 instance_name (instance_dir|-u) [install_tpl] [em_file]" 1>&2
5
-	echo -e "\n\tIf -u given as first argument update instance's loader.py" 1>&2
4
+	echo -e "Usage : $0 instance_name (instance_dir|-u) [install_tpl] [em_file] [lidir]" >&2
5
+	echo -e "\n\tIf -u given as first argument update instance's loader.py" >&2
6 6
 	exit 1
7 7
 }
8 8
 
@@ -15,7 +15,7 @@ cp_loader() {
15 15
 
16 16
 if [ $# -lt 2 ]
17 17
 then
18
-	echo "Not enough arguments" 1>&2
18
+	echo "Not enough arguments" >&2
19 19
 	usage
20 20
 fi
21 21
 
@@ -24,12 +24,21 @@ fi
24 24
 name="$1"
25 25
 instdir="$2"
26 26
 
27
-
28
-libdir=[@]PKGPYTHONDIR[@]
27
+libdir="$5"
28
+libdir=${libdir:=[@]PKGPYTHONDIR[@]}
29 29
 install_tpl="$3"
30
-[ -z "$install_tpl" ] && usage
30
+if [ -z "$install_tpl" ]
31
+then
32
+	echo -e "Install template $install_tpl not found.\n" >&2
33
+	usage
34
+fi
35
+
31 36
 em_file="$4"
32
-[ -z "$em_file" ] && usage
37
+if [ -z "$em_file" ]
38
+then
39
+	echo -e "Emfile $emfile not found.\n" >&2
40
+	usage
41
+fi
33 42
 
34 43
 
35 44
 libdir=$(realpath $libdir)

Loading…
取消
儲存