From: Ant Zucaro <azucaro@gmail.com>
Date: Sun, 13 Dec 2020 14:27:22 +0000 (-0500)
Subject: Add script to sync checkupdate.txt on the web host.
X-Git-Tag: xonotic-v0.8.5~78^2~1
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7dcb54c199acf6b7fd460fc5f962d1d269a0854e;p=xonotic%2Fxonotic.git

Add script to sync checkupdate.txt on the web host.
---

diff --git a/misc/infrastructure/refresh-checkupdate.sh b/misc/infrastructure/refresh-checkupdate.sh
new file mode 100755
index 00000000..a08edd4e
--- /dev/null
+++ b/misc/infrastructure/refresh-checkupdate.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Script to sync the "checkupdate.txt" file on the web host with the version currently in git. 
+# Run this as root from the /var/www/update.xonotic.org directory.
+
+set -e
+
+export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
+cd /var/www/update.xonotic.org
+
+rm -f checkupdate.txt
+wget -qO checkupdate.txt "http://git.xonotic.org/?p=xonotic/xonotic.git;a=blob_plain;f=misc/infrastructure/checkupdate.txt"
+{
+	grep "^V " checkupdate.txt | head -n 1 | cut -c 3-
+	grep "^D " checkupdate.txt | head -n 1 | cut -c 3-
+	grep "^U " checkupdate.txt | head -n 1 | cut -c 3-
+} > checkupdate.txt.oldformat 2>/dev/null
+grep '^[^#]' checkupdate.txt > checkupdate.txt.newformat
+rm -f checkupdate.txt
+if [ x"`wc -l < checkupdate.txt.oldformat`" = x"3" ]; then
+	mv checkupdate.txt.newformat HTML/checkupdate.txt
+	mv checkupdate.txt.oldformat ../xonotic.org/HTML/dl/checkupdate.txt
+else
+	echo "checkupdate.txt updating failed. Please debug."
+fi
+