You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
Bash
64 lines
1.8 KiB
Bash
8 years ago
|
#!/usr/bin/env bash
|
||
|
# vim:ts=4:sts=4:sw=4:et
|
||
|
#
|
||
|
# Author: Hari Sekhon
|
||
|
# Date: 2016-08-01 10:17:55 +0100 (Mon, 01 Aug 2016)
|
||
|
#
|
||
|
# https://github.com/harisekhon/bash-tools
|
||
|
#
|
||
|
# License: see accompanying Hari Sekhon LICENSE file
|
||
|
#
|
||
|
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
|
||
|
#
|
||
|
# https://www.linkedin.com/in/harisekhon
|
||
|
#
|
||
|
|
||
7 years ago
|
set -euo pipefail
|
||
8 years ago
|
[ -n "${DEBUG:-}" ] && set -x
|
||
7 years ago
|
|
||
7 years ago
|
echo "================================================================================"
|
||
|
echo " G r o o v y I n s t a l l"
|
||
|
echo "================================================================================"
|
||
8 years ago
|
|
||
7 years ago
|
GROOVY_VERSION=${1:-${GROOVY_VERSION:-2.4.7}}
|
||
8 years ago
|
|
||
|
BASE=/opt
|
||
|
|
||
7 years ago
|
date '+%F %T Starting...'
|
||
|
start_time="$(date +%s)"
|
||
|
echo
|
||
7 years ago
|
|
||
8 years ago
|
if ! [ -e "$BASE/groovy" ]; then
|
||
|
mkdir -p "$BASE"
|
||
|
cd "$BASE"
|
||
|
wget -t 100 --retry-connrefused "https://dl.bintray.com/groovy/maven/apache-groovy-binary-$GROOVY_VERSION.zip" && \
|
||
|
unzip "apache-groovy-binary-$GROOVY_VERSION.zip" && \
|
||
|
ln -sv "groovy-$GROOVY_VERSION" groovy && \
|
||
|
rm -f "apache-groovy-binary-$GROOVY_VERSION.zip"
|
||
|
echo
|
||
|
echo "Groovy Install done"
|
||
|
else
|
||
|
echo "$BASE/groovy already exists - doing nothing"
|
||
|
fi
|
||
|
if ! [ -e /etc/profile.d/groovy.sh ]; then
|
||
|
echo "Adding /etc/profile.d/groovy.sh"
|
||
|
# shell execution tracing comes out in the file otherwise
|
||
|
set +x
|
||
|
cat >> /etc/profile.d/groovy.sh <<EOF
|
||
|
export GROOVY_HOME=/opt/groovy
|
||
|
export PATH=\$PATH:\$GROOVY_HOME/bin
|
||
|
EOF
|
||
|
fi
|
||
7 years ago
|
|
||
7 years ago
|
echo
|
||
|
date '+%F %T Finished'
|
||
|
echo
|
||
7 years ago
|
end_time="$(date +%s)"
|
||
5 years ago
|
time_taken="$((end_time - start_time))"
|
||
7 years ago
|
echo "Completed in $time_taken secs"
|
||
|
echo
|
||
|
echo "=================================================="
|
||
|
echo " Groovy Install Completed"
|
||
|
echo "=================================================="
|
||
7 years ago
|
echo
|