Last active
August 21, 2018 06:54
-
-
Save savsgio/9a07699ccee8d418943dc619697ddef7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
GOVERSION="1.10.3" | |
JAPOVERSION="2.0.0" | |
WHOAMI=$(whoami) | |
GOBIN_IS_SET=$(cat /etc/environment | grep "/usr/local/go/bin:/usr/local/go/deps/bin" | wc -l) | |
GOPATH_IS_SET=$(cat /etc/environment | grep GOPATH | wc -l) | |
if [ ${WHOAMI} != "root" ]; then | |
echo "------------------------------------" | |
echo "##### Execute script with root #####" | |
echo "------------------------------------" | |
exit 0 | |
fi | |
echo "Installing build-essential..." | |
apt-get update | |
apt-get install -y build-essential | |
echo "Installing Go ${GOVERSION} ..." | |
cd /usr/src | |
if [ ! -d /usr/local/go ]; then | |
wget https://dl.google.com/go/go${GOVERSION}.linux-amd64.tar.gz | |
tar xzf go${GOVERSION}.linux-amd64.tar.gz -C /usr/local | |
else | |
echo "Go is already installed..." | |
fi | |
if [ ! -d /usr/local/go/deps ]; then | |
mkdir -p /usr/local/go/deps | |
mkdir -p /usr/local/go/deps/bin | |
fi | |
chown root:root -R /usr/local/go | |
if [ ${GOBIN_IS_SET} = 0 ]; then | |
echo "PATH=${PATH}:/usr/local/go/bin:/usr/local/go/deps/bin" > /etc/environment | |
fi | |
if [ ${GOPATH_IS_SET} = 0 ]; then | |
echo "GOPATH=/usr/local/go/deps " >> /etc/environment | |
fi | |
. /etc/environment | |
echo "Installing dep..." | |
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
echo "Installing japo..." | |
wget https://github.com/savsgio/japo/archive/v${JAPOVERSION}.tar.gz | |
tar xvf v${JAPOVERSION}.tar.gz -C . | |
cd japo-${JAPOVERSION}/ | |
make | |
make install | |
echo "Installing japo daemon..." | |
make daemon | |
echo "\nRemeber customize '/etc/japo.yml' with your own configuration...\n" | |
echo "Enjoy..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment