#!/bin/bash # Pack translations # Copyright (C) 2007-2008 Andrius Štikonas # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . source `dirname $0`/variables if [ ! $DIFF ]; then echo -e $RED"This program needs the diff utility."$ENDCOLOR exit 1 fi if [ ! $TAR ]; then echo -e $RED"This program needs the tar utility."$ENDCOLOR exit 1 fi if [ ! $BZIP2 ]; then echo -e $RED"This program needs the bzip2 utility."$ENDCOLOR exit 1 fi counter=0 for BRANCH in $TRUNK $BRANCHES; do echo -e "Branch: $BLUE$BRANCH"$ENDCOLOR DIR="$PREFIX-$BRANCH" mkdir "$LCODE-temp" for file in `ls $DIR/wesnoth*.$LCODE.po`; do bfile=`basename $file` echo -n "Processing catalog $bfile... "; d=`echo "$bfile" | sed "s/.$LCODE.po//"` if [ -f "$BRANCH/$d/$LCODE.po" ]; then if ! $DIFF -q "$file" "$BRANCH/$d/$LCODE.po" > /dev/null ; then mkdir "$LCODE-temp/$d" cp "$file" "$LCODE-temp/$d/$LCODE.po" echo -e $GREEN"OK"$ENDCOLOR counter=$(($counter+1)) else echo -e $BLUE"Skipping"$ENDCOLOR fi else mkdir -p "$LCODE-temp/$d" cp "$file" "$LCODE-temp/$d/$LCODE.po" echo -e $GREEN"OK"$ENDCOLOR counter=$(($counter+1)) fi done if [ -f "$LCODE-$BRANCH.tar.bz2" ]; then echo "Removing old archive." rm -f "$LCODE-$BRANCH.tar.bz2" fi if [ ! $counter -eq 0 ]; then $TAR --remove-files -cf $LCODE-$BRANCH.tar --transform s/$LCODE-temp// $LCODE-temp $BZIP2 --best $LCODE-$BRANCH.tar echo "New archive created." else rmdir $LCODE-temp fi done echo -e $GREEN"Finished."$ENDCOLOR