From d3f495b75dbe1fb0d4c4fac54b3e0e8214940086 Mon Sep 17 00:00:00 2001 From: gumi Date: Tue, 16 Jan 2018 13:28:23 -0500 Subject: combine make-updates and make-music (again) --- client/make-music.sh | 81 --------------------------------------- client/make-updates | 91 -------------------------------------------- client/make-updates.sh | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 172 deletions(-) delete mode 100644 client/make-music.sh delete mode 100755 client/make-updates create mode 100755 client/make-updates.sh diff --git a/client/make-music.sh b/client/make-music.sh deleted file mode 100644 index 5530f69..0000000 --- a/client/make-music.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2011-2012 Evol Online -# Author: Andrei Karas (4144) - -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 -e "\e[105m======= Legacy-music =======\e[0m" - -echo -e "\e[96m>> Building adler32...\e[0m" -rm -f adler32 2>/dev/null || : -$CC -lz adler32.c -o adler32 - -echo -e "\e[96m>> Creating directory tree...\e[0m" -mkdir -pv files -mkdir -pv $output - -echo -e "\e[96m>> Removing leftovers...\e[0m" -rm -v files/Legacy-music.zip 2>/dev/null || : -rm -v $output/Legacy-music.zip 2>/dev/null || : - -echo -e "\e[96m>> Entering client-data...\e[0m" -pushd $cdata &>/dev/null -echo -e "\e[96m>> Compressing files...\e[0m" -find -path ./sfx -prune -o -iregex ".+[.]\(ogg\)" -printf "%P\n" | zip -X -@ $dir/files/Legacy-music.zip -touch $dir/files/Legacy-music.zip -echo -e "\e[96m>> Dumping git revision to file...\e[0m" -git rev-parse HEAD >$dir/musiccommit.txt - -pushd $dir/files &>/dev/null -echo -e "\e[96m>> Calculating adler32 checksum...\e[0m" -sum=`../adler32 1 Legacy-music.zip` - -echo -e "\e[96m>> Generating xml file...\e[0m" -echo " " >> xml_header.txt - -cp xml_header.txt resources.xml -cat xml_footer.txt >>resources.xml - -echo -e "\e[96m>> Moving stuff around...\e[0m" -cp -v Legacy-music.zip $output/ -cp -v resources.xml $output/ - -echo -e "\e[96m>> Giving read permissions...\e[0m" -pushd $output &>/dev/null -chmod a+r Legacy-music.zip -chmod a+r resources.xml - -echo -e "\e[96m>> Checking updates...\e[0m" -check_update "$http_root/Legacy-music.zip" -check_update "$http_root/resources.xml" - -popd &>/dev/null # $dir/files -popd &>/dev/null # $cdata -popd &>/dev/null # tools/client diff --git a/client/make-updates b/client/make-updates deleted file mode 100755 index ce2fb8b..0000000 --- a/client/make-updates +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2011-2012 Evol Online -# 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 -e "\e[105m======= Legacy =======\e[0m" - -echo -e "\e[96m>> Building adler32...\e[0m" -rm -f adler32 2>/dev/null || : -$CC -lz adler32.c -o adler32 - -echo -e "\e[96m>> Creating directory tree...\e[0m" -mkdir -pv files -mkdir -pv $output -mkdir -pv $cdata/music - -chmod a+rx ./make-music.sh - -echo -e "\e[96m>> Removing leftovers...\e[0m" -rm -rv files/* 2>/dev/null || : -rm -v $output/Legacy.zip 2>/dev/null || : - -echo -e "\e[96m>> Entering client-data...\e[0m" -pushd $cdata &>/dev/null -echo -e "\e[96m>> Compressing files...\e[0m" -find -path ./music -prune -o -iregex ".+[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" -printf "%P\n" | zip -X -@ $dir/files/Legacy.zip -echo -e "\e[96m>> Dumping git revision to file...\e[0m" -git rev-parse HEAD >$dir/commit.txt - -pushd $dir/files &>/dev/null -echo -e "\e[96m>> Calculating adler32 checksum...\e[0m" -sum=`../adler32 1 Legacy.zip` -echo "Legacy.zip ${sum}" >resources2.txt - -echo -e "\e[96m>> Generating xml file...\e[0m" -echo ' -' >xml_header.txt -echo '' >xml_footer.txt - -echo " " >> xml_header.txt -cp xml_header.txt resources.xml -cat xml_footer.txt >>resources.xml - -echo -e "\e[96m>> Moving stuff around...\e[0m" -cp -v Legacy.zip $output/ -cp -v resources2.txt $output/ -cp -v resources.xml $output/ - -echo -e "\e[96m>> Giving read permissions...\e[0m" -pushd $output &>/dev/null -chmod a+r Legacy.zip -chmod a+r resources2.txt -chmod a+r resources.xml - -echo -e "\e[96m>> Checking updates...\e[0m" -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 &>/dev/null # $dir/files -popd &>/dev/null # $cdata -popd &>/dev/null # tools/client diff --git a/client/make-updates.sh b/client/make-updates.sh new file mode 100755 index 0000000..26b7d60 --- /dev/null +++ b/client/make-updates.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash + +# Copyright (C) 2011-2012 Evol Online +# 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 +} + +function finish() { + retVal=$? + echo + if [ ${retVal} == "0" ]; then + echo -e "\e[96m>> Done!\e[0m" + fi +} + +trap finish EXIT + + +echo -e "\e[105m======= Legacy =======\e[0m" + +echo -e "\e[96m>> Building adler32...\e[0m" +rm -f adler32 2>/dev/null || : +$CC -lz adler32.c -o adler32 + +echo -e "\e[96m>> Creating directory tree...\e[0m" +mkdir -pv files +mkdir -pv $output +mkdir -pv $cdata/music + +echo -e "\e[96m>> Removing leftovers...\e[0m" +rm -rv files/* 2>/dev/null || : +rm -v $output/Legacy.zip 2>/dev/null || : +rm -v $output/Legacy-music.zip 2>/dev/null || : +rm -v $output/resources.xml 2>/dev/null || : +rm -v $output/resources2.txt 2>/dev/null || : # Legacy: used by mana client + +echo -e "\e[96m>> Entering client-data...\e[0m" +pushd $cdata &>/dev/null + +echo -e "\e[96m>> Compressing files...\e[0m" +find -path ./music -prune -o -iregex ".+[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" -printf "%P\n" | zip -X -@ $dir/files/Legacy.zip +find -path ./sfx -prune -o -iregex ".+[.]\(ogg\)" -printf "%P\n" | zip -X -@ $dir/files/Legacy-music.zip +touch $dir/files/Legacy-music.zip + +echo -e "\e[96m>> Calculating adler32 checksum...\e[0m" +pushd $dir/files &>/dev/null +sum=`../adler32 1 Legacy.zip` +musicsum=`../adler32 1 Legacy-music.zip` + +echo -e "\e[96m>> Generating xml file...\e[0m" +echo "" >resources.xml +echo "" >>resources.xml +echo "" >>resources.xml +echo "" >>resources.xml + +echo -e "\e[96m>> Moving stuff around...\e[0m" +cp -v Legacy.zip $output/ +cp -v Legacy-music.zip $output/ +cp -v resources.xml $output/ + +echo -e "\e[96m>> Giving read permissions...\e[0m" +pushd $output &>/dev/null +chmod a+r Legacy.zip +chmod a+r Legacy-music.zip +chmod a+r resources.xml + +echo +echo -e "\e[96m>> Checking updates...\e[0m" +check_update "$http_root/Legacy.zip" +check_update "$http_root/Legacy-music.zip" +check_update "$http_root/resources.xml" +check_update "$http_root/news.php" + +popd &>/dev/null # $dir/files +popd &>/dev/null # $cdata +popd &>/dev/null # tools/client -- cgit v1.2.3-70-g09d2