-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·52 lines (46 loc) · 1.79 KB
/
setup.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
#!/usr/bin/env bash
set -e
# set -x # Uncomment to debug
if [ -z $( (uname -a | grep Darwin &> /dev/null) && command -v brew ) ]; then
# TODO: check for ruby and exit if not available.
echo "Installing brew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
if [ -z "$(command -v curl)" ]; then
echo "Installing curl..."
if [ -n "$(command -v brew)" ]; then
brew install curl > /dev/null
elif [ -n "$(command -v apt-get)" ]; then
apt-get install curl -y > /dev/null
else
echo "Only apt-get or brew supported for curl installation, either install manually or fix this script for your system" && exit 1
fi
fi
if [ -z "$( ((command -v javac &> /dev/null) && javac -version 2>&1) | grep '1.8') " ]; then
echo "Installing java 1.8..."
if [ -n "$(command -v brew)" ]; then
brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
export JAVA_HOME=$(/usr/libexec/java_home -v"1.8")
elif [ -n "$(command -v apt-get)" ]; then
apt-get install python-software-properties
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
else
echo "Only apt-get or brew supported for java installation, either install manually or fix this script for your system" && exit 1
fi
fi
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${MY_DIR}"
mkdir -p "${MY_DIR}/bin"
mkdir -p "${MY_DIR}/tmp"
mkdir -p "${MY_DIR}/lib"
if [ ! -f "${MY_DIR}/bin/lein" ]; then
echo "Installing local lein..."
curl --silent "https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein" > "${MY_DIR}/bin/lein"
fi
chmod +x "${MY_DIR}/bin/lein"
"${MY_DIR}/bin/lein" &> /dev/null
echo "Installing dependencies..."
"${MY_DIR}/bin/lein" deps &> /dev/null