-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall_miniconda.sh
executable file
·41 lines (35 loc) · 1.47 KB
/
install_miniconda.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
#!/bin/bash -e
source miniconda_info.sh
#Helper function
install_linux() {
if [ ! -f "Miniconda-${MINICONDA_VERSION}-Linux-x86_64.sh" ]; then
curl -s https://repo.continuum.io/miniconda/Miniconda-${MINICONDA_VERSION}-Linux-x86_64.sh > Miniconda-${MINICONDA_VERSION}-Linux-x86_64.sh
fi
bash Miniconda-${MINICONDA_VERSION}-Linux-x86_64.sh -b -f -p ${MINICONDA_DIRECTORY}
}
install_osx() {
if [ ! -f "Miniconda-${MINICONDA_VERSION}-MacOSX-x86_64.sh" ]; then
curl -s https://repo.continuum.io/miniconda/Miniconda-${MINICONDA_VERSION}-MacOSX-x86_64.sh > Miniconda-${MINICONDA_VERSION}-MacOSX-x86_64.sh
fi
bash Miniconda-${MINICONDA_VERSION}-MacOSX-x86_64.sh -b -f -p ${MINICONDA_DIRECTORY}
}
echo "Installing Miniconda version: ${MINICONDA_VERSION} at path: ${MINICONDA_DIRECTORY}"
# Ensure the directory exists
if [ -w `dirname "${MINICONDA_DIRECTORY}"` ] ; then
mkdir -p "${MINICONDA_DIRECTORY}" 2>/dev/null
else
echo "You will need sudo access to create the miniconda directory: ${MINICONDA_DIRECTORY}"
sudo mkdir -p "${MINICONDA_DIRECTORY}" 2>/dev/null
sudo chown "${USER}" "${MINICONDA_DIRECTORY}"
fi
# Start installing
if [ ! -f "${MINICONDA_DIRECTORY}/installed_${MINICONDA_VERSION}" ]; then
if [ `uname` = "Darwin" ]; then
install_osx
else
install_linux
fi
echo "Install complete" > "${MINICONDA_DIRECTORY}/installed_${MINICONDA_VERSION}"
else
echo "Miniconda has already been successfully installed"
fi