|
@@ -1,13 +1,13 @@
|
1
|
1
|
#!/bin/bash
|
2
|
2
|
|
3
|
3
|
usage() {
|
4
|
|
- echo -e "Usage : $0 instance_name (instance_dir|-u) [lodel_libdir]" 1>&2
|
|
4
|
+ echo -e "Usage : $0 instance_name (instance_dir|-u) [install_tpl] [em_file]" 1>&2
|
5
|
5
|
echo -e "\n\tIf -u given as first argument update instance's loader.py" 1>&2
|
6
|
6
|
exit 1
|
7
|
7
|
}
|
8
|
8
|
|
9
|
9
|
cp_loader() {
|
10
|
|
- cp -Rv $libdir/install/loader.py $instdir/
|
|
10
|
+ cp -Rv $install_tpl/loader.py $instdir/
|
11
|
11
|
# Adding lib path to loader
|
12
|
12
|
sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"
|
13
|
13
|
}
|
|
@@ -24,8 +24,24 @@ fi
|
24
|
24
|
name="$1"
|
25
|
25
|
instdir="$2"
|
26
|
26
|
|
27
|
|
-libdir="$3"
|
28
|
|
-libdir="${libdir:=$(realpath $(dirname $0)/..)}/"
|
|
27
|
+
|
|
28
|
+libdir=$(realpath $(dirname $0))
|
|
29
|
+install_tpl="$3"
|
|
30
|
+install_tpl="${install_tpl:=$libdir/install}"
|
|
31
|
+em_file="$4"
|
|
32
|
+em_file="${em_file:=$libdir/examples/em_test.pickle}"
|
|
33
|
+
|
|
34
|
+libdir=$(realpath $libdir)
|
|
35
|
+install_tpl=$(realpath $install_tpl)
|
|
36
|
+em_file=$(realpath $em_file)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+if test ! -d $install_tpl
|
|
40
|
+then
|
|
41
|
+ echo "Install template directory '$install_tpl' not found"
|
|
42
|
+ echo ""
|
|
43
|
+ usage
|
|
44
|
+fi
|
29
|
45
|
|
30
|
46
|
loader="$instdir/loader.py"
|
31
|
47
|
conf="$instdir/conf.d/lodel2.ini"
|
|
@@ -48,11 +64,11 @@ mkdir -pv "$instdir"
|
48
|
64
|
mkdir -pv "$instdir/sessions"
|
49
|
65
|
chmod 700 "$instdir/sessions"
|
50
|
66
|
|
51
|
|
-#cp -Rv $libdir/install/* $instdir
|
52
|
|
-cp -Rv $libdir/install/conf.d $instdir/
|
53
|
|
-cp -Rv $libdir/examples/em_test.pickle $instdir/editorial_model.pickle
|
54
|
|
-ln -sv $libdir/install/Makefile $instdir/Makefile
|
55
|
|
-ln -sv $libdir/install/lodel_admin.py $instdir/lodel_admin.py
|
|
67
|
+#cp -Rv $install_tpl/* $instdir
|
|
68
|
+cp -Rv $install_tpl/conf.d $instdir/
|
|
69
|
+cp -Rv $em_file $instdir/editorial_model.pickle
|
|
70
|
+ln -sv $install_tpl/Makefile $instdir/Makefile
|
|
71
|
+ln -sv $install_tpl/lodel_admin.py $instdir/lodel_admin.py
|
56
|
72
|
ln -sv $libdir/plugins $instdir/plugins
|
57
|
73
|
cp_loader
|
58
|
74
|
# Adding instance name to conf
|