diff --git a/setup_bedrock.sh b/setup_bedrock.sh index dd5b3f8..ab172fe 100644 --- a/setup_bedrock.sh +++ b/setup_bedrock.sh @@ -1,20 +1,39 @@ #!/bin/bash -# Minecraft Bedrock Server Installer -# Works on Proxmox VM & LXC +# Minecraft Bedrock Server Installer for Proxmox (VM & LXC) +# Dynamically fetches the latest Bedrock server version # Author: TimInTech # Install Dependencies -apt update && apt install -y unzip wget screen +apt update && apt install -y unzip wget screen curl # Create Bedrock Server Directory mkdir -p /opt/minecraft-bedrock && cd /opt/minecraft-bedrock -# Download Bedrock Server -wget -O bedrock-server.zip https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.62.01.zip -unzip bedrock-server.zip +# Fetch the latest Bedrock Server download URL +LATEST_URL=$(curl -s https://www.minecraft.net/en-us/download/server/bedrock | grep -o 'https://minecraft.azureedge.net/bin-linux/bedrock-server-[0-9.]*.zip' | head -1) -# Create a Start Script +# Check if URL was found +if [[ -z "$LATEST_URL" ]]; then + echo "❌ ERROR: Could not fetch the latest Bedrock server version. Check the official page: https://www.minecraft.net/en-us/download/server/bedrock" + exit 1 +fi + +echo "🌍 Downloading latest Bedrock Server from: $LATEST_URL" +wget -O bedrock-server.zip "$LATEST_URL" + +# Verify the download +if [[ $? -ne 0 ]]; then + echo "❌ ERROR: Download failed. Please check your network or try manually downloading from:" + echo "$LATEST_URL" + exit 1 +fi + +# Unzip the downloaded server files +unzip -o bedrock-server.zip +rm -f bedrock-server.zip + +# Create a start script cat < start.sh #!/bin/bash LD_LIBRARY_PATH=. ./bedrock_server @@ -22,7 +41,7 @@ EOF chmod +x start.sh -# Start Server in Screen Session +# Start the server in a screen session screen -dmS bedrock ./start.sh -echo "✅ Minecraft Bedrock Server setup completed! Use 'screen -r bedrock' to access the console." +echo "✅ Minecraft Bedrock Server installation complete! Use 'screen -r bedrock' to access the console."