-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·76 lines (65 loc) · 2.24 KB
/
install.sh
File metadata and controls
executable file
·76 lines (65 loc) · 2.24 KB
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
#!/bin/bash -xe
#
# A script to setup the Travis build environment with Miniconda
# and install the LSST stack into it
#
MINICONDA_VERSION=${MINICONDA_VERSION:-3.19.0} # you can use "latest" if you don't care
CHANNEL=${CHANNEL:-"http://conda.lsst.codes/sims"} # the URL to the conda channel where LSST conda packages reside
PACKAGES="$@" # the top-level LSST package you want installed (lsst-distrib for DM, lsst-sims for simulations)
########################################################################################################
CACHE_DIR="$HOME/miniconda.tarball"
CACHE_DIR_TMP="$CACHE_DIR.tmp"
CACHE_TARBALL_NAME="miniconda.tar.gz"
CACHE_TARBALL_PATH="$CACHE_DIR/$CACHE_TARBALL_NAME"
store_info()
{
# Store a record of what's in the cached tarball
# This record allows us to automatically regenerate the tarball if the
# installed packages change.
rm -f "$1"
cat > "$1" <<-EOT
# -- cache information; autogenerated by ci/install.sh
MINICONDA_VERSION=$MINICONDA_VERSION
CHANNEL=$CHANNEL
PACKAGES=$PACKAGES
EOT
cat "$1"
}
store_info "$HOME/info.txt"
if [[ -f "$CACHE_TARBALL_PATH" ]] && cmp "$HOME/info.txt" "$CACHE_DIR/info.txt"; then
#
# Restore from cached tarball
#
tar xzf "$CACHE_TARBALL_PATH" -C "$HOME"
ls -l "$HOME"
else
#
# Miniconda install
#
# Install Python 2.7 Miniconda
rm -rf "$HOME/miniconda"
curl -L -O "https://repo.continuum.io/miniconda/Miniconda2-$MINICONDA_VERSION-Linux-x86_64.sh"
bash "Miniconda2-$MINICONDA_VERSION-Linux-x86_64.sh" -b -p "$HOME/miniconda"
export PATH="$HOME/miniconda/bin:$PATH"
#
# Disable MKL. The stack doesn't play nice with it (symbol collisions)
#
conda install --yes nomkl
#
# Stack install
#
conda config --add channels "$CHANNEL"
conda install -q --yes $PACKAGES # -q is needed, otherwise TravisCI kills the job due too much output in the log (4MB)
# Minimize our on-disk footprint
conda clean -iltp --yes
#
# Pack for caching. We pack here as Travis tends to time out if it can't pack
# the whole directory in ~180 seconds.
#
rm -rf "$CACHE_DIR" "$CACHE_DIR_TMP"
mkdir "$CACHE_DIR_TMP"
tar czf "$CACHE_DIR_TMP/$CACHE_TARBALL_NAME" -C "$HOME" miniconda
mv "$HOME/info.txt" "$CACHE_DIR_TMP"
mv "$CACHE_DIR_TMP" "$CACHE_DIR" # Atomic rename
ls -l "$CACHE_DIR"
fi