Files
ftbdw20118/downloadpack.sh
2022-05-14 23:44:31 -05:00

22 lines
786 B
Bash

#!/bin/bash
set -e # Error out immediately on failed line
set +x # Don't print commands as they are run
if [[ -z "${MODPACKID}" ]] || [[ -z "${VERSION}" ]];
then
echo "Invalid MODPACKID or VERSION"
exit 1
fi
# If we're using the latest version (it's not manually specified)
if [ "$VERSION" == "LATEST" ]
# Lookup the latest version available from the API and save it to the version variable
then VERSION=$(curl https://api.modpacks.ch/public/modpack/$MODPACKID/ | jq '.versions[-1].id'); fi;
echo "Downloading installer..."
wget https://api.modpacks.ch/public/modpack/$MODPACKID/$VERSION/server/linux --content-disposition
#echo "Renaming..."
#mv ./serverinstall_"$MODPACKID"_"$VERSION" ./serverinstall
echo "Making it executable..."
chmod +x ./serverinstall_"$MODPACKID"_"$VERSION"