-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·86 lines (60 loc) · 2.29 KB
/
install.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
#!/bin/bash
set -evx
#####################################################
# User specific
# SCM-atlas version
ATLAS_VERSION=1.3
# Directory where SCM-atlas is installed
DIR_ATLAS=$HOME/Tools/SCM-atlas/V${ATLAS_VERSION}
# Directory where SCM-atlas will be run
DIR_RUN=$HOME/Atlas1D/V${ATLAS_VERSION}
# Directory where References can be found
DIR_REF=/cnrm/amacs/USERS/roehrig/share/SCM-atlas/References/V1.3
#####################################################
DIR0=`pwd`
#####################################################
# Some tests to avoid overwriting
if [ -d "$DIR_ATLAS" ]; then
echo "DIR_ATLAS="$DIR_ATLAS
echo "DIR_ATLAS already exists. Please remove it or modify DIR_ATLAS at the top of install.sh"
exit
fi
if [ -d "$DIR_RUN" ]; then
echo "DIR_RUN="$DIR_RUN
echo "DIR_RUN already exists. Please remove it or modify DIR_RUN at the top of install.sh"
exit
fi
#####################################################
# Download and install SCM-atlas in DIR_ATLAS
[ -d $DIR_ATLAS ] || mkdir -p $DIR_ATLAS
cd $DIR_ATLAS
wget https://github.com/romainroehrig/SCM-atlas/archive/V${ATLAS_VERSION}.tar.gz
tar zxvf V${ATLAS_VERSION}.tar.gz
rm -f V${ATLAS_VERSION}.tar.gz
mv SCM-atlas-${ATLAS_VERSION}/* .
rm -rf SCM-atlas-${ATLAS_VERSION}
#####################################################
# Prepare what is needed to run SCM-atlas simulations in DIR_RUN
[ -d "$DIR_RUN" ] || mkdir -p $DIR_RUN
cd $DIR_RUN
cp -r $DIR_ATLAS/examples/* .
ln -s $DIR_ATLAS/apptools/run_atlas1d.py
tmp=$(printf '%s' "$DIR_ATLAS" | sed -e 's/[\/&]/\\&/g')
sed -i.bak "s/__DIR_ATLAS__/"$tmp"/" setenv
tmp=$(printf '%s' "$DIR_REF" | sed -e 's/[\/&]/\\&/g')
sed -i.bak "s/__DIR_REF__/"$tmp"/" setenv
#####################################################
# Some Testing
testing="y"
if [ "$testing" == "y" ]; then
source setenv
tmp=$(printf '%s' "$DIR_ATLAS" | sed -e 's/[\/&]/\\&/g')
sed -i.bak "s/__DIR_ATLAS__/"$tmp"/" $DIR_ATLAS/test/config_test.py
tmp=$(printf '%s' "$DIR_RUN" | sed -e 's/[\/&]/\\&/g')
sed -i.bak "s/__DIR_RUN__/"$tmp"/" $DIR_ATLAS/test/config_test.py
run_atlas1d.py -config $DIR_ATLAS/test/config_test.py
echo "Check atlas at $DIR_RUN/MyAtlas/TEST/html/index.html"
fi
#####################################################
# Back in directory where installation was launched
cd $DIR0