resonite/scripts/02_setup_config.sh
Merith-TK f9f1b195c0
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 47s
begin work on monkeyloader
2025-01-07 18:29:41 +00:00

69 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
## Setup Resonite Config
echo "Setting up Resonite Config"
# if CONFIG_FILE is not set, use default config path
if [ ! -f $CONFIG_FILE ]; then
echo "No Resonite Config found, copying from template"
cp /mnt/defaults/resonite.json $CONFIG_FILE
fi
CONFIG_DATA=$(grep -v " null," "$CONFIG_FILE")
if [ ! -n "$CONFIG_DATA" ]; then
echo "Config file is empty, copying from template"
cp /mnt/defaults/resonite.json $CONFIG_FILE
CONFIG_DATA=$(grep -v " null," "$CONFIG_FILE")
fi
if [ "$MONKEY_LOADER" == "true" ]; then
echo "Downloading MonkeyLoader"
# Define variables
monkeyloader_url="https://github.com/ResoniteModdingGroup/MonkeyLoader.GamePacks.Resonite/releases/download/v0.21.2/MonkeyLoader-v0.24.0+Resonite-v0.21.2+RML-v3.0.4.zip"
destination_dir="/data/resonite/Headless"
zip_file="$destination_dir/MonkeyLoader.zip"
# Check if the zip file already exists
if [ ! -f "$zip_file" ]; then
echo "Downloading from $monkeyloader_url to $zip_file"
curl -L -o "$zip_file" "$monkeyloader_url"
else
echo "File already exists: $zip_file, skipping download."
fi
if [ ! -f "/data/resonite/Headless/run_monkeyloader.sh" ]; then
# Extract the zip file
echo "Extracting $zip_file to $destination_dir"
unzip -o "$zip_file" -d "$destination_dir"
# Clean up zip-specific structure (move contents correctly if necessary)
if [ -d "$destination_dir/zipfiles" ]; then
echo "Moving extracted contents to $destination_dir"
mv "$destination_dir/zipfiles/"* "$destination_dir"
rmdir "$destination_dir/zipfiles"
fi
fi
if [ -f "$destination_dir/MonkeyLoader/GamePacks/MonkeyLoader.GamePacks.Resonite.Unity.nupkg" ]; then
rm "$destination_dir/MonkeyLoader/GamePacks/MonkeyLoader.GamePacks.Resonite.Unity.nupkg"
fi
if [ -f "$destination_dir/MonkeyLoader/GamePacks/MonkeyLoader.GamePacks.Unity.nupkg" ]; then
rm "$destination_dir/MonkeyLoader/GamePacks/MonkeyLoader.GamePacks.Unity.nupkg"
fi
echo "MonkeyLoader setup complete."
else
echo "MonkeyLoader Disabled"
# Remove MonkeyLoader directory and run_monkeyloader.sh script if they exist
if [ -d "/data/resonite/Headless/MonkeyLoader" ]; then
echo "Removing MonkeyLoader directory"
rm -rf "/data/resonite/Headless/MonkeyLoader"
fi
if [ -f "/data/resonite/Headless/run_monkeyloader.sh" ]; then
echo "Removing run_monkeyloader.sh script"
rm -f "/data/resonite/Headless/run_monkeyloader.sh"
fi
fi