-
Notifications
You must be signed in to change notification settings - Fork 2
/
create_gluex_top.sh
executable file
·91 lines (89 loc) · 2.17 KB
/
create_gluex_top.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
gluex_top_dir=gluex_top
reuse_gluex_top_dir=false
build_scripts_default_url=https://github.com/jeffersonlab/build_scripts
build_scripts_url=$build_scripts_default_url
while getopts "s:b:t:ru:" arg
do
case $arg in
s)
default_version_set=$OPTARG
;;
b)
build_scripts_branch=$OPTARG
;;
t)
gluex_top_dir=$OPTARG
;;
r)
reuse_gluex_top_dir=true
;;
u)
build_scripts_url=$OPTARG
;;
esac
done
# GI_PATH is the fully qualified directory that contains this script
gi_script="${BASH_SOURCE[0]}";
if([ -h "${gi_script}" ]) then
while([ -h "${gi_script}" ]) do gi_script=`readlink "${gi_script}"`; done
fi
pushd . > /dev/null
cd `dirname ${gi_script}` > /dev/null
GI_PATH=`pwd`
popd > /dev/null
#
if [ "$reuse_gluex_top_dir" = "false" ]
then
if [ -d $gluex_top_dir ]
then
echo "create_gluex_top.sh error: $gluex_top_dir already exists, exiting"
exit 1;
fi
fi
mkdir -p $gluex_top_dir
pushd $gluex_top_dir
pwd_string=`pwd`
mkdir -p resources
if [ -e build_scripts ]
then
echo build_scripts already here, skip installation
else
echo cloning build_scripts repository
git clone $build_scripts_url
pushd build_scripts > /dev/null
if [ -z $build_scripts_branch ]
then
if [ "$build_scripts_url" = "$build_scripts_default_url" ]
then # this is the "JeffersonLab" repo, other repos may not have releases defined
./update_to_latest.sh
fi
else
echo info: checking out branch $build_scripts_branch
if ! git checkout $build_scripts_branch
then
echo error: branch not checked out
cd ..
rm -rf build_scripts
exit 1
fi
fi
popd > /dev/null
fi
if [ -e halld_versions ]
then
echo halld_versions already here, skip installation
else
echo cloning halld_versions repository
git clone https://github.com/jeffersonlab/halld_versions
fi
if [ $default_version_set ]
then
if [ ! -e halld_versions/$default_version_set ]
then
echo error: default version set file halld_versions/$default_version_set not found
exit 2
fi
echo create_gluex_top.sh info: default version set will be $default_version_set
fi
$GI_PATH/create_setup_scripts.sh $pwd_string $default_version_set