44 lines
1.3 KiB
Bash
44 lines
1.3 KiB
Bash
#!/bin/bash
|
|
<% local config = require "config" %>
|
|
<% local secrets = require "secrets" %>
|
|
|
|
exec 1>>~/message.log 2>&1
|
|
set -x
|
|
|
|
echo "Starting main" >> ~/message.log
|
|
|
|
aws configure set aws_access_key_id "<%- secrets.access_key %>"
|
|
aws configure set aws_secret_access_key "<%- secrets.secret_key %>"
|
|
|
|
mkdir /mnt
|
|
mount /dev/sdf /mnt
|
|
sudo yum install java-17-amazon-corretto-devel -y
|
|
cd /mnt
|
|
|
|
UA="User-Agent: tempmc (alex@cogarr.net)"
|
|
|
|
# Download the dedicated server if we don't have it
|
|
if [ ! -e fabric-server-mc.1.20.4-loader.0.15.9-launcher.1.0.0.jar ]; then
|
|
echo "Downloading fabricmc" >> ~/message.log
|
|
curl -OJ https://meta.fabricmc.net/v2/versions/loader/1.20.4/0.15.9/1.0.0/server/jar
|
|
# Run it to download the mojang jar
|
|
java -Xmx2G -jar fabric-server-mc.1.20.4-loader.0.15.9-launcher.1.0.0.jar nogui --nogui
|
|
# It will error out because we haven't accepted the eula
|
|
sed -i s/eula=false/eula=true/g eula.txt
|
|
fi
|
|
|
|
# Then download mods
|
|
cd mods
|
|
echo "Downloading <%- #config.mods.server %> mods" >> ~/message.log
|
|
|
|
<% for _,mod in pairs(config.mods.server) do %>
|
|
URL=<%- mod %>
|
|
echo "Checking $(basename $URL)" >> ~/message.log
|
|
if [ ! -e "$(basename $URL)" ]; then
|
|
echo "Downloading $URL" >> ~/message.log
|
|
curl -OJ "$URL"
|
|
else
|
|
echo "$URL already exists" >> ~/message.log
|
|
fi
|
|
<% end %>
|