cleanup and function updates
All checks were successful
Build and Push Minecraft Docker Images on Debian-base update / poll-debian-base-and-detect-changes (push) Successful in 12s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push neoforged (push) Successful in 21s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push fabric (push) Successful in 1m2s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push bukkit (push) Successful in 1m6s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-fabric (push) Successful in 15s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-forge (push) Successful in 19s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-vanilla (push) Successful in 14s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-bukkit (push) Successful in 1m19s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push vanilla (push) Successful in 13s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push forge (push) Successful in 2m15s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-neoforged (push) Successful in 1m30s
Build and Push Minecraft Docker Images on Debian-base update / generate-changelogs (push) Successful in 9s
Build and Push Minecraft Docker Images on Debian-base update / generate-build-info (push) Successful in 1m58s
All checks were successful
Build and Push Minecraft Docker Images on Debian-base update / poll-debian-base-and-detect-changes (push) Successful in 12s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push neoforged (push) Successful in 21s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push fabric (push) Successful in 1m2s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push bukkit (push) Successful in 1m6s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-fabric (push) Successful in 15s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-forge (push) Successful in 19s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-vanilla (push) Successful in 14s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-bukkit (push) Successful in 1m19s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push vanilla (push) Successful in 13s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push forge (push) Successful in 2m15s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing-neoforged (push) Successful in 1m30s
Build and Push Minecraft Docker Images on Debian-base update / generate-changelogs (push) Successful in 9s
Build and Push Minecraft Docker Images on Debian-base update / generate-build-info (push) Successful in 1m58s
This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020 fithwum
|
||||
# Copyright (c) 2022 fithwum
|
||||
# All rights reserved
|
||||
|
||||
# Display setup
|
||||
#export DISPLAY=0
|
||||
MC_DIR=/MCserver
|
||||
|
||||
VERSION_CHECK=$(curl -s "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json" | grep -Pom 1 '"url": "\K[^"]*'$MC_VERSION'.json')
|
||||
MC_SERVER_FILE=$(curl -s $VERSION_CHECK | jq --raw-output '.downloads.server.url')
|
||||
MC_RUN_FILE=https://gitea.fithwum.tech/fithwum/minecraft/raw/branch/master/testing/run.sh
|
||||
|
||||
rm -fr /MCserver/MCserver_*.jar
|
||||
rm -fr /MCserver/run_*.sh
|
||||
MC_RUN_FILE=https://gitea.fithwum.tech/fithwum/minecraft/raw/branch/master/vanilla/run.sh
|
||||
|
||||
# Main install (Debian).
|
||||
# Check for files in /MCserver and download if needed.
|
||||
if [ -e /MCserver/MCserver-$MC_VERSION.jar ]
|
||||
# Check for server files and download if needed.
|
||||
if [ -e $MC_DIR/MCserver-$MC_VERSION.jar ]
|
||||
then
|
||||
echo " "
|
||||
echo "INFO ! MCserver-$MC_VERSION.jar found starting now."
|
||||
@@ -23,36 +19,38 @@ if [ -e /MCserver/MCserver-$MC_VERSION.jar ]
|
||||
echo "WARNING ! MCserver-$MC_VERSION.jar is out of date/missing ... will download now."
|
||||
echo " "
|
||||
echo "INFO ! Cleaning old files."
|
||||
mkdir /MCserver/old-server-versions/
|
||||
mv /MCserver/MCserver-*.jar /MCserver/old-server-versions/
|
||||
mv /MCserver/run-*.sh /MCserver/old-server-versions/
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MC_SERVER_FILE -O /MCserver/MCserver-$MC_VERSION.jar
|
||||
chmod +x /MCserver/MCserver-$MC_VERSION.jar
|
||||
mkdir $MC_DIR/old-server-versions/
|
||||
mv $MC_DIR/MCserver-*.jar $MC_DIR/old-server-versions/
|
||||
mv $MC_DIR/run-*.sh $MC_DIR/old-server-versions/
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MC_SERVER_FILE -O $MC_DIR/MCserver-$MC_VERSION.jar
|
||||
chmod +x $MC_DIR/MCserver-$MC_VERSION.jar
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
# Looking for run.sh
|
||||
if [ -e /MCserver/run-$MC_VERSION.sh ]
|
||||
# Looking for run-${MC_VERSION}.sh
|
||||
if [ -e $MC_DIR/run-$MC_VERSION.sh ]
|
||||
then
|
||||
echo " "
|
||||
echo "INFO ! run-$MC_VERSION.sh found ... will use existing file."
|
||||
else
|
||||
echo " "
|
||||
echo "WARNING ! run.sh is out of date/missing ... will download now."
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MC_RUN_FILE -O /MCserver/run-$MC_VERSION.sh
|
||||
chmod +x /MCserver/run-$MC_VERSION.sh
|
||||
rm -fr $MC_DIR/run_*.sh
|
||||
wget --no-cache --show-progress --progress=bar:force:noscroll $MC_RUN_FILE -O $MC_DIR/run-$MC_VERSION.sh
|
||||
chmod +x $MC_DIR/run-$MC_VERSION.sh
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
echo "INFO ! Setting game port."
|
||||
if [ -f $MC_DIR/server.properties ]; then
|
||||
sed -i '/server-port='*'/c\server-port='$GAME_PORT'' $MC_DIR/server.properties
|
||||
fi
|
||||
|
||||
# Check for EULA
|
||||
if [ ! -f /MCserver/eula.txt ]; then
|
||||
if [ ! -f $MC_DIR/eula.txt ]; then
|
||||
:
|
||||
else
|
||||
if [ "$ACCEPT_EULA" == "false" ]; then
|
||||
if grep -rq 'eula=true' /MCserver/eula.txt; then
|
||||
sed -i '/eula=true/c\eula=false' /MCserver/eula.txt
|
||||
if grep -rq 'eula=true' $MC_DIR/eula.txt; then
|
||||
sed -i '/eula=true/c\eula=false' $MC_DIR/eula.txt
|
||||
fi
|
||||
echo " "
|
||||
echo "WARNING ! EULA not accepted, you must accept the EULA"
|
||||
@@ -61,20 +59,18 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
if [ ! -f /MCserver/eula.txt ]; then
|
||||
if [ ! -f $MC_DIR/eula.txt ]; then
|
||||
echo " "
|
||||
echo "WARNING ! EULA not found please stand by..."
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$ACCEPT_EULA" == "true" ]; then
|
||||
if grep -rq 'eula=false' /MCserver/eula.txt; then
|
||||
sed -i '/eula=false/c\eula=true' /MCserver/eula.txt
|
||||
if grep -rq 'eula=false' $MC_DIR/eula.txt; then
|
||||
sed -i '/eula=false/c\eula=true' $MC_DIR/eula.txt
|
||||
echo " "
|
||||
echo "INFO ! EULA accepted, server restarting, please wait..."
|
||||
sleep 1
|
||||
exec /MCserver/run-$MC_VERSION.sh --dataPath=/MCserver
|
||||
exec $MC_DIR/run-$MC_VERSION.sh --dataPath=$MC_DIR
|
||||
exit 0
|
||||
fi
|
||||
elif [ "$ACCEPT_EULA" == "false" ]; then
|
||||
@@ -87,21 +83,15 @@ else
|
||||
echo "WARNING ! Something went wrong, please check EULA variable"
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
echo "INFO ! Setting game port."
|
||||
sed -i '/server-port='*'/c\server-port='$GAME_PORT'' /MCserver/server.properties
|
||||
sleep 1
|
||||
|
||||
# Set permissions.
|
||||
chown 99:100 -R /MCserver
|
||||
chmod 777 -R /MCserver
|
||||
chown 99:100 -R $MC_DIR
|
||||
chmod 777 -R $MC_DIR
|
||||
|
||||
sleep 1
|
||||
|
||||
# Run Minecraft server.
|
||||
echo " "
|
||||
echo "INFO ! Starting Minecraft Server $MC_VERSION"
|
||||
exec /MCserver/run-$MC_VERSION.sh --dataPath=/MCserver
|
||||
#screen -dmS mcserver /MCserver/run-$MC_VERSION.sh --dataPath=/MCserver
|
||||
exec $MC_DIR/run-$MC_VERSION.sh --dataPath=$MC_DIR
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user