-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate.sh
executable file
·39 lines (32 loc) · 980 Bytes
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# check latest commit
git clone --depth 1 https://github.com/PaperMC/Paper.git
cd Paper
MINECRAFT_VERSION_LATEST=$(cat gradle.properties | grep 'mcVersion =' | sed -e 's/mcVersion = //')
PAPER_VERSION_LATEST=$(cat gradle.properties | grep 'version =' | sed -e 's/version = //')
PAPER_COMMIT_LATEST=$(git rev-parse HEAD)
cd ..
rm -rf Paper
# check diff
source .env
echo "IMG_TAG=${IMG_TAG}" >> .env_latest
echo "MINECRAFT_VERSION='${MINECRAFT_VERSION_LATEST}'" >> .env_latest
echo "PAPER_VERSION='${PAPER_VERSION_LATEST}'" >> .env_latest
echo "PAPER_COMMIT=${PAPER_COMMIT_LATEST}" >> .env_latest
diff .env .env_latest
if [ $? -eq 0 ]; then
echo "no update"
rm .env_latest
exit 0
fi
diff <(echo $MINECRAFT_VERSION) <(echo $MINECRAFT_VERSION_LATEST)
if [ $? -ne 0 ]; then
echo "Minecraft version update!!!!!"
if [[ $1 != "minecraft" ]]; then
echo "please update manually: ./update.sh minecraft"
rm .env_latest
exit 1
fi
fi
# update
mv .env_latest .env