Skip to content

Instantly share code, notes, and snippets.

@kennytv
Last active June 17, 2020 09:27
Show Gist options
  • Save kennytv/9edff4b306164ab5c1956b8b2f216d6a to your computer and use it in GitHub Desktop.
Save kennytv/9edff4b306164ab5c1956b8b2f216d6a to your computer and use it in GitHub Desktop.
Maintenance API install shell script (https://github.com/KennyTV/Maintenance/wiki/API#api-usage)
#!/bin/bash
VERSION="3.0.5" #Version of the Maintenance Build
URL="https://github.com/KennyTV/Maintenance/raw/master/MaintenanceAPI.jar"
FILENAME="MaintenanceAPI.jar"
confirm=true
if [ "$1" == "skip-input" ]; then
confirm=false
fi
hash mvn 2>/dev/null || {
echo >&2 "Maven is required."
exit 1
}
echo -e "\e[32mMaintenance version ${VERSION}\e[0m"
if [ "$confirm" = true ] ; then
read -p $'\e[32mpress \e[5m[Enter] \e[25mto start Downloading...\e[0m'
fi
echo -e $'\e[32mDownloading...\e[0m'
wget -O $FILENAME $URL
if [ -e $FILENAME ]; then
echo -e "\e[32mFile downloaded.\e[0m"
else
echo "\e[32mError while downloading file.\e[0m"
exit 1
fi
echo -e "\e[32mInstalling $FILENAME in local maven repository.\e[0m"
if [ "$confirm" = true ] ; then
read -p $'\e[32mpress \e[5m[Enter] \e[25mto start...\e[0m'
fi
mvn install:install-file -Dfile=$FILENAME -DgroupId=eu.kennytv.maintenance -DartifactId=maintenance-api -Dversion=$VERSION -Dpackaging=jar
echo -e "\e[32mRemoving temp jar file...\e[0m"
rm -f $FILENAME
echo -e "\e[32mFinish!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment