diff options
author | jesusalva <cpntb1@ymail.com> | 2018-02-09 18:02:17 -0200 |
---|---|---|
committer | jesusalva <cpntb1@ymail.com> | 2018-02-09 18:02:17 -0200 |
commit | 5bacd1f63d141d9d4f9943d79f08161e707ab74f (patch) | |
tree | 8f49dd2257dec074d9b1d9a9234b9db9593b30f3 | |
parent | 6adb35b71a13e4acd82d3c6836ec006f1634f82f (diff) | |
download | tools-5bacd1f63d141d9d4f9943d79f08161e707ab74f.tar.gz tools-5bacd1f63d141d9d4f9943d79f08161e707ab74f.tar.bz2 tools-5bacd1f63d141d9d4f9943d79f08161e707ab74f.tar.xz tools-5bacd1f63d141d9d4f9943d79f08161e707ab74f.zip |
I can never compile adler, so instead of local-adler, use system-wide adler.
You need to make and install adler before running.
-rwxr-xr-x | update/addmods.sh | 6 | ||||
-rw-r--r-- | update/adler32_dir/Makefile | 16 | ||||
-rw-r--r-- | update/adler32_dir/adler32.c | 68 | ||||
-rw-r--r-- | update/commit.txt | 2 | ||||
-rwxr-xr-x | update/createnew.sh | 14 | ||||
-rw-r--r-- | update/news.txt | 11 | ||||
-rwxr-xr-x | update/update.sh | 14 |
7 files changed, 108 insertions, 23 deletions
diff --git a/update/addmods.sh b/update/addmods.sh index 3a4e036..6d6f146 100755 --- a/update/addmods.sh +++ b/update/addmods.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright (C) 2010-2012 Evol Online +# Copyright (C) 2010-2012 TMW2 Online # Author: Andrei Karas (4144) dir=`pwd` @@ -19,9 +19,9 @@ FILES=`ls` for file in $FILES; do cd $file - find . -type f | xargs zip -9 -r ../../../../evol-tools/update/files/mod-$file.zip + find . -type f | xargs zip -9 -r ../../../../TMW2-tools/update/files/mod-$file.zip cd $dir/files - sum=`../adler32 1 mod-$file.zip` + sum=`adler32 1 mod-$file.zip` echo " <update type=\"data\" group=\"$file\" file=\"mod-$file.zip\" hash=\"${sum}\" />" >> xml_header.txt cp xml_header.txt resources.xml cat xml_footer.txt >>resources.xml diff --git a/update/adler32_dir/Makefile b/update/adler32_dir/Makefile new file mode 100644 index 0000000..42f101a --- /dev/null +++ b/update/adler32_dir/Makefile @@ -0,0 +1,16 @@ +prefix=/usr/local +bindir=${prefix}/bin + +LDLIBS=-lz + +all: adler32 + +adler32: adler32.c + +clean: + rm -f adler32 + +install: + install -D adler32 ${bindir}/ + +.PHONY: clean install diff --git a/update/adler32_dir/adler32.c b/update/adler32_dir/adler32.c new file mode 100644 index 0000000..5dd7e4c --- /dev/null +++ b/update/adler32_dir/adler32.c @@ -0,0 +1,68 @@ +/* + * adler32.c (c) 2006 Bjorn Lindeijer + * License: GPL, v2 or later + * + * Calculates Adler-32 checksums for all files passed as argument. + * + * Usage: adler32 [file]... + */ + +#include <stdlib.h> +#include <stdio.h> +#include <zlib.h> + +/** + * Calculates the Adler-32 checksum for the given file. + */ +unsigned long fadler32(FILE *file) +{ + // Obtain file size + fseek(file, 0, SEEK_END); + long fileSize = ftell(file); + rewind(file); + + // Calculate Adler-32 checksum + char *buffer = (char*) malloc(fileSize); + fread(buffer, 1, fileSize, file); + unsigned long adler = adler32(0L, Z_NULL, 0); + adler = adler32(adler, (Bytef*) buffer, fileSize); + free(buffer); + + return adler; +} + +/** + * Prints out usage and exists. + */ +void print_usage() +{ + printf("Usage: adler32 [file]...\n"); + exit(0); +} + +int main(int argc, char *argv[]) +{ + int i; /**< Loops through arguments. */ + + if (argc == 1) + { + print_usage(); + } + + for (i = 1; i < argc; ++i) + { + FILE *file = fopen(argv[i], "r"); + + if (!file) + { + printf("Error while opening '%s' for reading!\n", argv[i]); + exit(1); + } + + unsigned long adler = fadler32(file); + printf("%s %lx\n", argv[i], adler); + fclose(file); + } + + return 0; +} diff --git a/update/commit.txt b/update/commit.txt index 28fbb5d..0aaffa1 100644 --- a/update/commit.txt +++ b/update/commit.txt @@ -1 +1 @@ -ce88604cd7b7c8abd121aef12b38a1fd409ef181 +12635dbdb9886c3a3e9c4a3e518f50df3e03b442 diff --git a/update/createnew.sh b/update/createnew.sh index 86a6b93..49710cb 100755 --- a/update/createnew.sh +++ b/update/createnew.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright (C) 2011-2012 Evol Online +# Copyright (C) 2011-2012 TMW2 Online # Author: Andrei Karas (4144) dir=`pwd` @@ -11,25 +11,25 @@ gcc -lz adler32.c -o adler32 mkdir files mkdir upload -rm files/evol.zip +rm files/TMW2.zip cd ../../client-data find -iregex ".+[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" -exec touch --date=2015-01-01 {} \; -find -iregex ".+[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" -printf "%P\n" | zip -X -@ ../tools/update/files/evol.zip +find -iregex ".+[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" -printf "%P\n" | zip -X -@ ../tools/update/files/TMW2.zip git log --pretty=oneline -n 1 | awk '{print $1}' >../tools/update/commit.txt cd $dir/files -sum=`../adler32 1 evol.zip` -echo "evol.zip ${sum}" >resources2.txt +sum=`adler32 1 TMW2.zip` +echo "TMW2.zip ${sum}" >resources2.txt echo '<?xml version="1.0"?> <updates>' >xml_header.txt echo '</updates>' >xml_footer.txt -echo " <update type=\"data\" file=\"evol.zip\" hash=\"${sum}\" />" >> xml_header.txt +echo " <update type=\"data\" file=\"TMW2.zip\" hash=\"${sum}\" />" >> xml_header.txt cp xml_header.txt resources.xml cat xml_footer.txt >>resources.xml -cp evol.zip ../upload/ +cp TMW2.zip ../upload/ cp resources2.txt ../upload/ cp resources.xml ../upload/ cp ../news.txt ../upload/ diff --git a/update/news.txt b/update/news.txt index cb6b8d1..5a41924 100644 --- a/update/news.txt +++ b/update/news.txt @@ -1,19 +1,20 @@ -##0 Actual Release: ##1Pilot-I +##0 Actual Release: ##1Pilot-I Testing ##0 Welcome to ##BThe Mana World 2##b! -##0 By playing to agree and abid to the ##1Terms of Service##0 of ##BThe Mana World 2##b, available at: +##0 By playing you agree and abide to the ##1Terms of Service##0 of ##BThe Mana World 2##b, available at: ##1 [@@https://gitlab.com/TMW2/TheManaWorld_Wiki/wikis/Rules|https://gitlab.com/TMW2/TheManaWorld_Wiki/wikis/Rules@@] ##7 ##BThe adventure begins!##b -##7 Season 1, Episode 1! +##7 Release 1: Candy! ##0 The work which started at mid-january is currently advancing. -##0 You can travel with Nard to Candor and visit Tulishmar. +##0 You can travel with Nard to Candor and later, you'll be able to visit Tulishmar. ##0 Remember that this is not TMW:rEvolt, even if many aspects are similar. ##0 Due the very early stages of development, we may need to do a full account reset ##0 before next release, so do not get too attached to it :> +##0 The early stage also means constant server resets and updates. Sorry. ##0 This is a Pilot Release, and therefore, not much content is present. ##0 We welcome all contributors who are willing to join. @@ -23,5 +24,5 @@ ##9 -- Your TMW2 Team ##9 February 2018 -##0 You can check out this page for older news entries: +##0 You can check out this page for older news entries: (TODO) ##1 [@@http://wiki.evolonline.org/news|http://wiki.evolonline.org/news@@] diff --git a/update/update.sh b/update/update.sh index 01dab51..2a446db 100755 --- a/update/update.sh +++ b/update/update.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright (C) 2010-2012 Evol Online +# Copyright (C) 2010-2012 TMW2 Online # Author: Andrei Karas (4144) dir=`pwd` @@ -19,19 +19,19 @@ u1=`echo ${previous} | cut -c 1-7` u2=`echo ${head} | cut -c 1-7` git log --name-status ${previous}..${head} | awk '/^(A|M)\t/ {print $2}' | \ grep -e "[.]\(xml\|png\|tmx\|ogg\|txt\|po\|tsx\)" | sort | uniq | \ - xargs zip -X -9 -r ../tools/update/files/evol-${u1}..${u2}.zip + xargs zip -X -9 -r ../tools/update/files/TMW2-${u1}..${u2}.zip cd $dir/files -if [ -f evol-${u1}..${u2}.zip ]; then +if [ -f TMW2-${u1}..${u2}.zip ]; then mv ../commit.txt ../commit_old.txt echo ${head} >../commit.txt - sum=`../adler32 1 evol-${u1}..${u2}.zip` - echo "evol-${u1}..${u2}.zip ${sum}" >>resources2.txt - echo " <update type=\"data\" file=\"evol-${u1}..${u2}.zip\" hash=\"${sum}\" />" >> xml_header.txt + sum=`adler32 1 TMW2-${u1}..${u2}.zip` + echo "TMW2-${u1}..${u2}.zip ${sum}" >>resources2.txt + echo " <update type=\"data\" file=\"TMW2-${u1}..${u2}.zip\" hash=\"${sum}\" />" >> xml_header.txt cp xml_header.txt resources.xml cat xml_footer.txt >>resources.xml - cp evol-${u1}..${u2}.zip ../upload/ + cp TMW2-${u1}..${u2}.zip ../upload/ cp resources2.txt ../upload/ cp resources.xml ../upload/ cp ../news.txt ../upload |