diff options
author | Vincent Petithory <vincent.petithory@gmail.com> | 2013-09-24 20:41:01 +0200 |
---|---|---|
committer | Vincent Petithory <vincent.petithory@gmail.com> | 2013-09-24 20:41:01 +0200 |
commit | 7b3fc1dbc951f8e49b06c95c6ed44f943ff4c6b3 (patch) | |
tree | 9d4a33b3f429f88cccf719790b8be0bfe4cb3fbf /client/client-updates/src | |
parent | 4271bbbcf141d474048ac3b5e369b4ecbfb0aac6 (diff) | |
download | tools-7b3fc1dbc951f8e49b06c95c6ed44f943ff4c6b3.tar.gz tools-7b3fc1dbc951f8e49b06c95c6ed44f943ff4c6b3.tar.bz2 tools-7b3fc1dbc951f8e49b06c95c6ed44f943ff4c6b3.tar.xz tools-7b3fc1dbc951f8e49b06c95c6ed44f943ff4c6b3.zip |
Remove deprecated client-updates
Diffstat (limited to 'client/client-updates/src')
-rw-r--r-- | client/client-updates/src/adler32.c | 68 | ||||
-rwxr-xr-x | client/client-updates/src/client-updates-gen | 68 | ||||
-rwxr-xr-x | client/client-updates/src/client-updates-inspect | 20 | ||||
-rwxr-xr-x | client/client-updates/src/client-updates-news | 14 | ||||
-rwxr-xr-x | client/client-updates/src/client-updates-push | 8 | ||||
-rw-r--r-- | client/client-updates/src/client-updates.conf.example | 15 | ||||
-rw-r--r-- | client/client-updates/src/makefile | 9 |
7 files changed, 0 insertions, 202 deletions
diff --git a/client/client-updates/src/adler32.c b/client/client-updates/src/adler32.c deleted file mode 100644 index 5dd7e4c..0000000 --- a/client/client-updates/src/adler32.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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/client/client-updates/src/client-updates-gen b/client/client-updates/src/client-updates-gen deleted file mode 100755 index 76c0ed3..0000000 --- a/client/client-updates/src/client-updates-gen +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -# Check we are on the $CLIENT_DATA_BRANCH branch -git --git-dir "${CLIENT_DATA_DIR}/.git" branch | grep -q "^* $CLIENT_DATA_BRANCH" || { echo "The client-data repository is not on $CLIENT_DATA_BRANCH branch. Exiting"; exit 2; } - -# Unless specified on 1st argument, we'll use the latest revision that was -# included in updates, as starting revision. -# If this is the initial generation, this argument is mandatory. -if [ $# -gt 0 ]; then - OLD_CLIENT_DATA_HEAD="$1" -else - # Get the last commit sha where we generated an update - # This assumes the generated zip names follow the pattern: update-SHA1..SHA2.zip - OLD_CLIENT_DATA_HEAD=$(tail -n 1 ${UPDATES_DIR}/release/resources2.txt | cut -d . -f 3) -fi - -# Unless specified on 2nd argument, we'll use the HEAD as final revision. -if [ $# -gt 1 ]; then - NEW_CLIENT_DATA_HEAD="$2" -else - # get the commit SHA from the client data repo - NEW_CLIENT_DATA_HEAD=$(git --git-dir "${CLIENT_DATA_DIR}/.git" rev-parse HEAD | cut -c 1-7) -fi - -if [ "$OLD_CLIENT_DATA_HEAD" = "$NEW_CLIENT_DATA_HEAD" ]; then - echo "Everything is up-to-date." - exit 0 -fi - -update_basename="update-${OLD_CLIENT_DATA_HEAD}..${NEW_CLIENT_DATA_HEAD}" - -# generate a diff of files to package -cd ${CLIENT_DATA_DIR} -git --git-dir "${CLIENT_DATA_DIR}/.git" log --name-status ${OLD_CLIENT_DATA_HEAD}..${NEW_CLIENT_DATA_HEAD} | awk '/^(A|M)\t/ {print $2}' | sort | uniq | xargs zip -9 -r "${UPDATES_DIR}/${update_basename}.zip" > /dev/null -cd - > /dev/null - -if [ ! -f "${UPDATES_DIR}/${update_basename}.zip" ];then - echo "Error while generating ${update_basename}.zip. Exiting." > /dev/stderr - exit 1 -fi - -# package update -cd "${UPDATES_DIR}" -mkdir -p "release" -${SRC}/adler32 "${update_basename}.zip" >> "release/resources2.txt" -hash=$(tail -n 1 "release/resources2.txt" | awk '{ print $2; }') -# populate resources.xml as well -xmlentry="<update type=\"data\" file=\"${update_basename}.zip\" hash=\"${hash}\" />" - -sed -i '$d' 'release/resources.xml' -echo " $xmlentry" >> 'release/resources.xml' -echo '</updates>' >> 'release/resources.xml' - -echo "Adding ${update_basename}.zip:" -# Display the contents of the update -unzip -l ${update_basename}.zip -mv "${update_basename}.zip" "release/" -# Copy resources -git add 'release' -git commit -m "Updating resources to ${NEW_CLIENT_DATA_HEAD}" > /dev/null -cd - > /dev/null - -exit 0 diff --git a/client/client-updates/src/client-updates-inspect b/client/client-updates/src/client-updates-inspect deleted file mode 100755 index 03ae2d6..0000000 --- a/client/client-updates/src/client-updates-inspect +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -#config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -DIRECTORY="${UPDATES_DIR}/release" -listing=$(mktemp) -IFS=' -' -for f in $(tac $DIRECTORY/resources2.txt); do - file=$(awk '{ print $1; }' <<< $f) - unzip -l "$DIRECTORY/$file" >> $listing -done - -if [ -f "$listing" ]; then - less "$listing" -fi -rm -f "$listing" diff --git a/client/client-updates/src/client-updates-news b/client/client-updates/src/client-updates-news deleted file mode 100755 index bc78e4e..0000000 --- a/client/client-updates/src/client-updates-news +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -# Edit news.txt -nano "${UPDATES_DIR}"/release/news.txt - -# Commit if changed -cd "${UPDATES_DIR}" -git status | grep -q 'news.txt' && { git add release/news.txt; git commit -m 'Updating news.txt' > /dev/null; } -cd - > /dev/null diff --git a/client/client-updates/src/client-updates-push b/client/client-updates/src/client-updates-push deleted file mode 100755 index edeae49..0000000 --- a/client/client-updates/src/client-updates-push +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# config -SRC=$(dirname $(readlink -f "$0")) - -. ${SRC}/client-updates.conf - -rsync -av --delete "$UPDATES_DIR/release/" "$UPDATES_PUBLISH_DIR" diff --git a/client/client-updates/src/client-updates.conf.example b/client/client-updates/src/client-updates.conf.example deleted file mode 100644 index 8bdce43..0000000 --- a/client/client-updates/src/client-updates.conf.example +++ /dev/null @@ -1,15 +0,0 @@ -# The client-data directory -CLIENT_DATA_DIR="$HOME/tmwa-client-data" - -# The updates working directory -UPDATES_DIR="$HOME/client-updates" - -# The git branch used for generating the updates -# This allows for more complex setups, where e.g a branch is used for merging -# from various other branches. It's used on the testing server -# Defaults to master -CLIENT_DATA_BRANCH=master - -# Local directory served by the web server, -# where the update files will be copied -UPDATES_PUBLISH_DIR="$HOME/www/tmwupdate" diff --git a/client/client-updates/src/makefile b/client/client-updates/src/makefile deleted file mode 100644 index 00acaf0..0000000 --- a/client/client-updates/src/makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: adler32 - -adler32: adler32.c - gcc -lz -o $@ $< - -clean: - rm -f adler32 - -.PHONY: clean |