-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.bash
56 lines (45 loc) · 1.06 KB
/
bootstrap.bash
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
#
# For Amazon Linux 2, x64 or ARM
# Also Amazon Linux 2023, Ubuntu
#
# GIT ID
export ME=lucianpls
export THIS_PROJECT=AHTSE
export GITHUB=https://github.com
sudo yum install -q -y git || sudo apt-get install -q -y git
refresh() {
project=$(basename $1)
if [[ ! -d $project ]]
then
git clone -q $1
else
(cd $project; git pull -q)
fi
if [[ ! -z "$2" ]]
then
(cd $project; git checkout -q $2)
fi
}
# Set PREFIX to /usr/local for system install, otherwise $HOME is used
export PREFIX=${PREFIX:-$HOME}
[ -d $HOME/src/ ] || mkdir $HOME/src
# $SUDO to be used for install commands
if [[ $PREFIX =~ ^/usr ]]
then
SUDO=sudo
else
SUDO=
fi
$SUDO mkdir $PREFIX/{bin,lib,include,modules}
# How many processors to use for compilation
export NP=$(nproc)
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib
pushd $HOME/src
refresh $GITHUB/$ME/$THIS_PROJECT
# Execute the updated scripts
. $HOME/src/$THIS_PROJECT/devtools.bash
. $HOME/src/$THIS_PROJECT/gdal.bash
. $HOME/src/$THIS_PROJECT/ahtse.bash
# To previous folder
popd