78 lines
2.2 KiB
Bash
78 lines
2.2 KiB
Bash
|
#!/bin/bash
|
||
|
# Pack translations
|
||
|
# Copyright (C) 2007-2008 Andrius Štikonas <stikonas@gmail.com>
|
||
|
#
|
||
|
# 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 <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
source variables
|
||
|
|
||
|
if [ ! $DIFF ]; then
|
||
|
echo -e "\E[31mThis program needs the diff utility."; tput sgr0
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ ! $TAR ]; then
|
||
|
echo -e "\E[31mThis program needs the tar utility."; tput sgr0
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ ! $BZIP2 ]; then
|
||
|
echo -e "\E[31mThis program needs the bzip2 utility."; tput sgr0
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
counter=0
|
||
|
|
||
|
for BRANCH in $TRUNK $BRANCHES; do
|
||
|
echo -e "Branch: \E[34m$BRANCH"; tput sgr0
|
||
|
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 "\E[32mOK"; tput sgr0
|
||
|
counter=$(($counter+1))
|
||
|
else
|
||
|
echo -e "\E[34mSkipping"; tput sgr0
|
||
|
fi
|
||
|
else
|
||
|
mkdir -p "$LCODE-temp/$d"
|
||
|
cp "$file" "$LCODE-temp/$d/$LCODE.po"
|
||
|
echo -e "\E[32mOK"; tput sgr0
|
||
|
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
|
||
|
echo ""
|
||
|
done
|
||
|
|
||
|
echo -ne "\E[32mFinished."; tput sgr0; echo " "
|