„scripts/start-server.sh“ ändern

This commit is contained in:
2021-05-12 09:23:54 +02:00
parent cb6a834697
commit 1d71725f68

View File

@@ -52,48 +52,48 @@ fi
if [ "${OXIDE_MOD}" == "true" ]; then
echo "---Oxide Mod enabled!---"
CUR_V="$(find ${SERVER_DIR} -maxdepth 1 -name rustinstalledv* | cut -d 'v' -f4-)"
CUR_V="$(find ${SERVER_DIR} -maxdepth 1 -name "OxideMod-*.zip" | cut -d '-' -f2)"
LAT_V="$(wget -qO- https://api.github.com/repos/OxideMod/Oxide.Rust/releases/latest | grep tag_name | cut -d '"' -f4)"
if [ -z ${LAT_V} ]; then
if [ -z ${CUR_V} ]; then
if [ -z ${CUR_V%.*} ]; then
echo "---Can't get latest Oxide Mod version and found no installed version, putting server into sleep mode!---"
sleep infinity
else
echo "---Can_t get latest Oxide Mod version, falling back to installed v${CUR_V}!---"
LAT_V="${CUR_V}"
echo "---Can_t get latest Oxide Mod version, falling back to installed v${CUR_V%.*}!---"
LAT_V="${CUR_V%.*}"
fi
fi
if [ -z "$CUR_V" ]; then
if [ -z "$CUR_V%.*" ]; then
echo "---Oxide Mod not found, downloading!---"
cd ${SERVER_DIR}
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${SERVER_DIR}/OxideMod.zip "https://github.com/OxideMod/Oxide.Rust/releases/download/${LAT_V}/Oxide.Rust-linux.zip" ; then
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${SERVER_DIR}/OxideMod-${LAT_V}.zip "https://github.com/OxideMod/Oxide.Rust/releases/download/${LAT_V}/Oxide.Rust-linux.zip" ; then
echo "---Successfully downloaded Oxide Mode v${LAT_V}!---"
else
echo "---Something went wrong, can't download Oxide Mod v${LAT_V}, putting server in sleep mode---"
sleep infinity
fi
unzip -o ${SERVER_DIR}/OxideMod.zip -d ${SERVER_DIR}
touch ${SERVER_DIR}/rustinstalledv${LAT_V}
rm -rf ${SERVER_DIR}/OxideMod.zip
elif [ "$LAT_V" != "$CUR_V" ]; then
unzip -o ${SERVER_DIR}/OxideMod-${LAT_V}.zip -d ${SERVER_DIR}
elif [ "$LAT_V" != "$CUR_V%.*" ]; then
cd ${SERVER_DIR}
rm -rf ${SERVER_DIR}/rustinstalledv*
echo "---Newer version of Oxide Mod v${LAT_V} found, currently installed: v${CUR_V}---"
rm ${SERVER_DIR}/${JAR_NAME}.jar
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${SERVER_DIR}/OxideMod.zip "https://github.com/OxideMod/Oxide.Rust/releases/download/${LAT_V}/Oxide.Rust-linux.zip" ; then
rm -rf ${SERVER_DIR}/OxideMod-*.zip
echo "---Newer version of Oxide Mod v${LAT_V} found, currently installed: v${CUR_V%.*}---"
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${SERVER_DIR}/OxideMod-${LAT_V}.zip "https://github.com/OxideMod/Oxide.Rust/releases/download/${LAT_V}/Oxide.Rust-linux.zip" ; then
echo "---Successfully downloaded Oxide Mod v${LAT_V}!---"
else
echo "---Something went wrong, can't download Oxide Mod v${LAT_V}, putting server in sleep mode---"
sleep infinity
fi
unzip -o ${SERVER_DIR}/OxideMod.zip -d ${SERVER_DIR}
touch ${SERVER_DIR}/rustinstalledv${LAT_V}
rm -rf ${SERVER_DIR}/OxideMod.zip
elif [ "$LAT_V" == "$CUR_V" ]; then
echo "---Oxide Mod v${CUR_V} is Up-To-Date!---"
unzip -o ${SERVER_DIR}/OxideMod${LAT_V}.zip -d ${SERVER_DIR}
elif [ "$LAT_V" == "$CUR_V%.*" ]; then
echo "---Oxide Mod v${CUR_V%.*} is Up-To-Date!---"
fi
if [ "${FORCE_OXIDE_INSTALLATION}" == "true" ]; then
unzip -o ${SERVER_DIR}/OxideMod-${LAT_V}.zip -d ${SERVER_DIR}
fi
fi
echo "---Prepare Server---"