#!/usr/bin/env bash # Copyright (C) 2011-2012 Evol Online # Author: Andrei Karas (4144) dir=`pwd` output=~/www/updates cdata=../../client-data LDLIBS=-lz prefix=/usr/local CC=${CC:=gcc} echo "======= Legacy =======" echo ">> Building adler32..." rm -f adler32 2>/dev/null || : $CC -lz adler32.c -o adler32 echo ">> Creating directory tree..." mkdir -pv files mkdir -pv $output mkdir -pv $cdata/music chmod u+x ./make-music.sh echo ">> Removing leftovers..." rm -rv files/* 2>/dev/null || : rm -v $output/Legacy.zip 2>/dev/null || : echo ">> Entering client-data..." pushd $cdata echo ">> Changing file dates..." find -path ./music -prune -o -iregex ".+[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" -exec touch --date=2015-01-01 {} \; echo ">> Compressing files..." find -path ./music -prune -o -iregex ".+[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" -printf "%P\n" | zip -X -@ $dir/files/Legacy.zip echo ">> Dumping git revision to file..." git rev-parse HEAD >$dir/commit.txt pushd $dir/files echo ">> Calculating adler32 checksum..." sum=`../adler32 1 Legacy.zip` echo "Legacy.zip ${sum}" >resources2.txt echo ">> Generating xml file..." 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 ">> Moving stuff around..." chmod a+r Legacy.zip cp -v Legacy.zip $output/ chmod a+r resources2.txt cp -v resources2.txt $output/ chmod a+r resources.xml cp -v resources.xml $output/ popd popd