23 lines
677 B
Plaintext
23 lines
677 B
Plaintext
|
#!/bin/sh
|
||
|
# Script to automatically look for and apply modpack updates via a git repo to a dockerized minecraft server.
|
||
|
|
||
|
## Change these variables to reflect your environment:
|
||
|
WORKING_DIR=$(dirname "$0") # Retrieves the directory of the script
|
||
|
CONTAINER_NAME="minecraft"
|
||
|
MODS_DIR="/var/minecraft"
|
||
|
GIT_BRANCH="main"
|
||
|
GIT_ALREADY_UPDATED_MESSAGE="Bereits aktuell."
|
||
|
|
||
|
## Update logic
|
||
|
cd "$WORKING_DIR" || exit
|
||
|
git checkout "$GIT_BRANCH"
|
||
|
if [ "$(git pull)" = "$GIT_ALREADY_UPDATED_MESSAGE" ]
|
||
|
then
|
||
|
echo "No update available."
|
||
|
else
|
||
|
echo "Update available, restarting server."
|
||
|
docker stop "$CONTAINER_NAME"
|
||
|
cp -r mods/* "$MODS_DIR"
|
||
|
docker start "$CONTAINER_NAME"
|
||
|
fi
|