shift around order of actions so they make sense for the heredoc files

This commit is contained in:
ida schmidt 2025-03-28 23:13:56 +00:00
parent 15bbc2e0e7
commit f23312cb36

View file

@ -21,16 +21,9 @@ else
apt install -y default-jre-headless
fi
# find the latest release of the requested version and download it
echo "downloading minecraft $VERSION..."
RELEASE=`curl -s https://api.papermc.io/v2/projects/paper/versions/$VERSION/ | jq -r .builds[-1]`
curl https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds/$RELEASE/downloads/paper-$VERSION-$RELEASE.jar -o paperclip.jar
echo "preparing..." # making sure things have the right owners
adduser --disabled-password --gecos "" mc
mkdir -p /srv/minecraft/
chown -R mc:mc /srv/minecraft/
chown mc:mc paperclip.jar
mkdir -p /srv/minecraft/{server,backups}
cat <<- 'EOF' > /etc/systemd/system/mc-server.service
[Unit]
Description=Minecraft server
@ -59,13 +52,13 @@ EOF
chown root:root /root/.local/bin/mc-backup
chmod 755 /root/.local/bin/mc-backup
echo "copying..." # move those files haha
cp systemd/{*.timer,*.service} /etc/systemd/system/
# dont like how this feels but i dont wanna have to change the permissions on .local folders if they exist
su mc -c \
"mkdir /srv/minecraft/{server,backups}
cp paperclip.jar /srv/minecraft/server/
echo "eula=true" > /srv/minecraft/server/eula.txt"
# find the latest release of the requested version and download it
echo "downloading minecraft $VERSION..."
RELEASE=`curl -s https://api.papermc.io/v2/projects/paper/versions/$VERSION/ | jq -r .builds[-1]`
curl https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds/$RELEASE/downloads/paper-$VERSION-$RELEASE.jar -o /srv/minecraft/server/paperclip.jar
chown -R mc:mc /srv/minecraft/
su mc -c 'echo "eula=true" > /srv/minecraft/server/eula.txt'
# what they say on the tin
echo "loading units..."