Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# MAVEN DEPS
declare -a array=("https://repo1.maven.org/maven2/org/graalvm/truffle/truffle-api"
"https://repo1.maven.org/maven2/org/graalvm/regex/regex"
"https://repo1.maven.org/maven2/com/ibm/icu/icu4j"
"https://repo1.maven.org/maven2/org/graalvm/sdk/graal-sdk"
"https://repo1.maven.org/maven2/org/graalvm/js/js"
"https://repo1.maven.org/maven2/org/graalvm/js/js-scriptengine")
#FIND SQLCL in the path
SQLCL_BINARY=`which sql`
echo $SQLCL_BINARY
SQLCL_HOME=`dirname ${SQLCL_BINARY}`
echo $SQLCL_HOME
SQLCL_LIB=$SQLCL_HOME/../lib/ext
if [ -d "$SQLCL_LIB" ]; then
echo "Installing into ${SQLCL_LIB}"
else
echo "No SQLcl found in PATH"
echo $PATH | tr ":" "\n"
exit
fi
# get length of an array
arraylength=${#array[@]}
# use for loop to read all values and indexes
for (( i=0; i<${arraylength}; i++ ));
do
VERSION=$(curl -sq "${array[$i]}/maven-metadata.xml" | grep latest | awk -F '[<>]' '{print $3}')
NAME=$(echo ${array[$i]} | awk -F "/" '{print $NF}')
FILENAME="$NAME-${VERSION}.jar"
URL="${array[$i]}/${VERSION}/${FILENAME}"
echo "Downloading $URL"
curl -q $URL > $SQLCL_LIB/$FILENAME
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment