-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_release.sh
64 lines (45 loc) · 975 Bytes
/
setup_release.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
#!/bin/bash
OS=$1
if [ $OS != 'Linux' ] && [ $OS != 'Mac' ]
then
echo 'Unknown Operating System'
echo 'Possibilities are Linux or Mac'
echo 'Can not go further'
set -e
fi
dir_rel=''
if [ $OS == 'Linux' ]
then
dir_rel='/cvmfs/sw.lsst.eu/linux-x86_64'
fi
if [ $OS == 'Mac' ]
then
dir_rel='/cvmfs/sw.lsst.eu/darwin-x86_64'
fi
#get the shell
myshell=$(echo $SHELL | rev | cut -d "/" -f1 | rev)
echo 'the shell is' $myshell
myshell='sh'
echo $myshell
if [ $myshell == 'sh' ]
then
myshell='bash'
fi
echo $myshell
# get distribs
array=($(ls -dtr $dir_rel/lsst_sims/*))
# print possible distribs
len=${#array[*]}
i=0
while [ $i -lt $len ]; do
echo "$i: ${array[$i]}"
let i++
done
# choose the latest-1 release installed
release=${array[$len-2]}
#Fill a file with the release chosen
echo "release: ${release}" >& current_release.yaml
# make the setups
echo 'Setting-up' ${release}
source ${release}/loadLSST.$myshell
setup lsst_sims