aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/install.sh.in
blob: 5108c7a25954ecee1ff2235d098ca7189bf519bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

CT_ROOT=$1
CT_VSN=@CT_VSN@
TS_VSN=@TS_VSN@

if [ -z "$CT_ROOT" ]
then
    echo "install.sh: need CT_ROOT (absolute) directory or 'local' as argument"
    exit 1
fi

if [ $CT_ROOT = "local" ]
then
    CT_DIR=`pwd`
    cd priv
    sed -e "s,@CTPATH@,$CT_DIR/ebin," \
        -e "s,@TSPATH@,$CT_DIR/../test_server/ebin," \
	run_test.in > bin/run_test
    chmod 775 bin/run_test
    echo "install successful, start script created in " $CT_ROOT/common_test-$CT_VSN/priv/bin
else

    if [ ! -d "$CT_ROOT" ]
    then
	echo "install.sh: CT_ROOT argument must be a valid directory"
	exit 1
    fi

    if [ `echo $CT_ROOT | awk '{ print substr($1,1,1) }'` != "/" ]
    then
	echo "install.sh: need an absolute path to CT_ROOT"
	exit 1
    fi

    if [ ! -d $CT_ROOT/common_test-$CT_VSN ]
    then
	echo "install.sh: The directory $CT_ROOT/common_test-$CT_VSN does not exist"
	exit 1
    fi

    if [ -d $CT_ROOT/common_test-$CT_VSN/priv ]
    then
	cd $CT_ROOT/common_test-$CT_VSN/priv
	sed -e "s;@CTPATH@;$CT_ROOT/common_test-$CT_VSN/ebin;" \
	    -e "s;@TSPATH@;$CT_ROOT/test_server-$TS_VSN/ebin;" \
	    run_test.in > bin/run_test
	chmod 775 bin/run_test
	echo "install successful, start script created in " $CT_ROOT/common_test-$CT_VSN/priv/bin
    fi
fi