docker-compose/minecraft/upgrade-mods.sh

47 lines
899 B
Bash
Raw Normal View History

#!/bin/bash
#echo "Stopping container..."
docker-compose down
if [ $? -ne 0 ]; then
exit $?
fi
echo "Container stopped"
echo "Performing upgrade..."
sleep 2
# Function to upgrade ferium and copy mods
upgrade_mods() {
rm mods/*.jar &&
ferium upgrade &&
rm mods/server/*.jar &&
rm mods/client/*.jar &&
cp mods/*.jar mods/server/ &&
cp mods/*.jar mods/client/ &&
chown -R thord:docker mods/*
chmod -R 755 mods/*
}
remove_unsupported_mod() {
local mod_name="$1"
find ./mods/server/ -maxdepth 1 -iname "${mod_name}*.jar" -exec rm {} \; && \
echo "Removed non-server mod: $mod_name"
}
# Call the functions
upgrade_mods
# List of unsupported mods to remove
source unsupported.sh
# Loop through unsupported mods and remove them
for mod in "${unsupported_mods[@]}"; do
remove_unsupported_mod "$mod"
done
echo "Starting container"
docker-compose up -d