-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap-spackdev
executable file
·64 lines (57 loc) · 1.31 KB
/
bootstrap-spackdev
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/sh
check_for_help () {
if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ]; then
echo "bootstrap-spackdev [-k] [DIR]"
echo " Installs Spack and SpackDev in DIR."
echo " DIR must already exist."
echo " If DIR is not specified, uses current directory."
exit 1
fi
}
check_for_keep () {
if [ "$1" = "-k" ]; then
keep=true
else
keep=false
fi
}
get_dir() {
if [ "$keep" = "true" ]; then
echo "shifting"
shift
fi
if [ -z "$1" ]; then
echo "empty"
req_dir="`pwd`"
else
echo "full"
req_dir="$1"
fi
cd "$req_dir" &&\
dir="`/bin/pwd`" && \
echo "using $dir for SpackDev and Spack install..."
}
get_spack() {
echo "checking out Spack... " && \
git clone --branch spackdev \
https://github.com/amundson/spack.git && \
echo "done."
}
get_spackdev() {
echo "checking out SpackDev... " && \
git clone https://github.com/amundson/spackdev.git && \
echo "done."
}
create_setup_sh() {
echo "creating setup.sh... " && \
echo "export PATH=\"$dir/spackdev/bin:\$PATH\"" > setup.sh && \
echo ". \"$dir/spack/share/spack/setup-env.sh\"" >> setup.sh && \
echo "done"
}
check_for_help "$@" &&\
check_for_keep "$@" &&\
get_dir "$@" &&\
get_spack &&\
get_spackdev &&\
create_setup_sh &&
echo "use \". $dir/setup.sh\" to get started"