]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
Add script to sync checkupdate.txt on the web host.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 13 Dec 2020 14:27:22 +0000 (09:27 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 13 Dec 2020 14:27:22 +0000 (09:27 -0500)
misc/infrastructure/refresh-checkupdate.sh [new file with mode: 0755]

diff --git a/misc/infrastructure/refresh-checkupdate.sh b/misc/infrastructure/refresh-checkupdate.sh
new file mode 100755 (executable)
index 0000000..a08edd4
--- /dev/null
@@ -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
+