diff options
author | gumi <git@gumi.ca> | 2018-01-16 11:45:39 -0500 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-01-16 11:45:39 -0500 |
commit | bf38d6cf388b687758f11c998f8eeab25fd21b25 (patch) | |
tree | 708243c2a3ecb28a2007db4a714fc6b9db0fe5a1 | |
parent | b90911151c327adc3674914350ae5358cb0184bb (diff) | |
download | tools-bf38d6cf388b687758f11c998f8eeab25fd21b25.tar.gz tools-bf38d6cf388b687758f11c998f8eeab25fd21b25.tar.bz2 tools-bf38d6cf388b687758f11c998f8eeab25fd21b25.tar.xz tools-bf38d6cf388b687758f11c998f8eeab25fd21b25.zip |
add update checker to make-updates
-rw-r--r-- | client/make-music.sh | 37 | ||||
-rwxr-xr-x | client/make-updates | 28 |
2 files changed, 60 insertions, 5 deletions
diff --git a/client/make-music.sh b/client/make-music.sh index cca2441..5b914cf 100644 --- a/client/make-music.sh +++ b/client/make-music.sh @@ -6,11 +6,31 @@ dir=`pwd` output=~/www/updates cdata=../../client-data +http_root="http://updates.themanaworld.org/updates" LDLIBS=-lz prefix=/usr/local CC=${CC:=gcc} +function check_update() { + test_command=` \ + curl -sL \ + -w "%{http_code}\n" \ + "$1" \ + -o /dev/null \ + --connect-timeout 3 \ + --max-time 5` + + if [ ${test_command} == "200" ] ; + then + echo -e "hit $1 (\e[92m$test_command OK\e[0m)"; + else + echo -e "\e[31m!!FAILED!!\e[0m $1 ($test_command)"; + exit 1; + fi +} + + echo "======= Legacy-music =======" echo ">> Building adler32..." @@ -46,9 +66,18 @@ cp xml_header.txt resources.xml cat xml_footer.txt >>resources.xml echo ">> Moving stuff around..." +cp -v Legacy-music.zip $output/ +cp -v resources.xml $output/ + +echo ">> Giving read permissions..." +pushd $output chmod a+r Legacy-music.zip -cp Legacy-music.zip $output/ chmod a+r resources.xml -cp resources.xml $output/ -popd -popd + +echo ">> Checking updates..." +check_update "$http_root/Legacy-music.zip" +check_update "$http_root/resources.xml" + +popd # $dir/files +popd # $cdata +popd # tools/client diff --git a/client/make-updates b/client/make-updates index 0f6ea67..0cab82f 100755 --- a/client/make-updates +++ b/client/make-updates @@ -1,16 +1,36 @@ #!/usr/bin/env bash # Copyright (C) 2011-2012 Evol Online -# Author: Andrei Karas (4144) +# Author: Andrei Karas (4144), gumi dir=`pwd` output=~/www/updates cdata=../../client-data +http_root="http://updates.themanaworld.org/updates" LDLIBS=-lz prefix=/usr/local CC=${CC:=gcc} +function check_update() { + test_command=` \ + curl -sL \ + -w "%{http_code}\n" \ + "$1" \ + -o /dev/null \ + --connect-timeout 3 \ + --max-time 5` + + if [ ${test_command} == "200" ] ; + then + echo -e "hit $1 (\e[92m$test_command OK\e[0m)"; + else + echo -e "\e[31m!!FAILED!!\e[0m $1 ($test_command)"; + exit 1; + fi +} + + echo "======= Legacy =======" echo ">> Building adler32..." @@ -62,6 +82,12 @@ chmod a+r Legacy.zip chmod a+r resources2.txt chmod a+r resources.xml +echo ">> Checking updates..." +check_update "$http_root/Legacy.zip" +check_update "$http_root/resources.xml" +check_update "$http_root/resources2.txt" +check_update "$http_root/news.php" + popd # $dir/files popd # $cdata popd # tools/client |