mirror of
https://github.com/parkervcp/eggs.git
synced 2026-06-12 17:13:36 +08:00
59 lines
2.0 KiB
JSON
59 lines
2.0 KiB
JSON
#!/bin/bash
|
|
#
|
|
# NeoForge Installation script
|
|
#
|
|
# Files kindly mirrored by invalidpandaa
|
|
# The install script contains parts of the orginal forge egg by parkervcp (c)
|
|
#
|
|
# Server files: /mnt/server
|
|
apt update
|
|
apt install -y curl jq
|
|
if [[ ! -d /mnt/server ]]; then
|
|
mkdir /mnt/server
|
|
fi
|
|
cd /mnt/server
|
|
DOWNLOAD_LINK=https://mirror.invalidpanda.dev/neoforge/${MC_VERSION}/installer.jar
|
|
# Download the installer
|
|
echo -e "Downloading NeoForge installer with Minecraft version ${MC_VERSION} \nDownload link is ${DOWNLOAD_LINK}\n"
|
|
if curl --output /dev/null --silent --head --fail "${DOWNLOAD_LINK}"; then
|
|
curl -LO ${DOWNLOAD_LINK}
|
|
# Check if file exists
|
|
if [ -e "installer.jar" ]; then
|
|
echo -e "Successfully downloaded installer.jar"
|
|
else
|
|
echo -e "Failed to download installer.jar. Exiting now! \n"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo -e "Couldn't reach the download server! If this error persists, please contact mail@invalidpanda.dev. \n"
|
|
exit 1
|
|
fi
|
|
function unix_args {
|
|
echo -e "Setting up Unix args..."
|
|
if [ "$MC_VERSION" = "1.20.1" ]; then
|
|
ln -sf libraries/net/neoforged/forge/*/unix_args.txt unix_args.txt
|
|
else
|
|
ln -sf libraries/net/neoforged/neoforge/*/unix_args.txt unix_args.txt
|
|
fi
|
|
}
|
|
# Delete args to support downgrading/upgrading
|
|
rm -rf libraries/net/neoforged/neoforge
|
|
rm -rf libraries/net/neoforged/forge # if on 1.20.1
|
|
rm unix_args.txt
|
|
# Installing NeoForge
|
|
echo -e "Installing NeoForge server \n"
|
|
java -jar installer.jar --installServer || { echo -e "\nFailed to install NeoForge server with Minecraft version ${MC_VERSION}! \nMake sure to allocate enough memory and disk space."; exit 4; }
|
|
# Check if we need a symlink for 1.17+ Forge JPMS args
|
|
if [[ $MC_VERSION =~ ^1\.(17|18|19|20|21|22|23) || $FORGE_VERSION =~ ^1\.(17|18|19|20|21|22|23) ]]; then
|
|
unix_args
|
|
fi
|
|
echo -e "Deleting installer.jar file.\n"
|
|
rm -rf installer.jar
|
|
echo "--------------------------------------------------------------------------------------
|
|
|
|
Installation complete!
|
|
|
|
If any issues occured during install, please contact mail@invalidpanda.dev.
|
|
|
|
--------------------------------------------------------------------------------------"
|