Last active
July 24, 2023 09:40
-
-
Save krisrice/47972a12535674b5380103ef1ac42b67 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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