wok annotate tramys-client/stuff/tramys2 @ rev 17082

Up: tramys-server and tramys-client (140824).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Aug 24 22:46:59 2014 +0300 (2014-08-24)
parents 096a77a2021d
children e96aa956e72e
rev   line source
al@17081 1 #!/bin/sh
al@17081 2 # tramys - TRAnslate MY Slitaz. Client solution
al@17081 3 # Tool for managing translation files for SliTaz GNU/Linux
al@17081 4 # Aleksej Bobylev <al.bobylev@gmail.com>, 2014
al@17081 5
al@17081 6 . /etc/slitaz/slitaz.conf
al@17081 7 . /lib/libtaz.sh
al@17082 8
al@17082 9 if [ $(id -u) != 0 ]; then
al@17082 10 exec tazbox su $0 $@; exit 0
al@17082 11 fi
al@17082 12
al@17082 13 export TEXTDOMAIN='tramys' # i18n
al@17081 14 WORKING=$(mktemp -d)
al@17082 15 LOG="/tmp/tramys.log"
al@17082 16 TGZ="/tmp/tramys.tgz"
al@17082 17 YADCONF="--center --window-icon=config-language --image=config-language --image-on-top"
al@17082 18
al@17082 19 yad $YADCONF --title="tramys (1/3)" --text="$(_ \
al@17082 20 'Now translations for all installed programs will be found and downloaded.
al@17082 21 You can change locale if you want, or proceed.
al@17082 22
al@17082 23 Your current locale: <b>$LANG</b>')" \
al@17082 24 --button "gtk-edit:2" --button "gtk-cancel:1" --button "gtk-go-forward:0"
al@17082 25 case $? in
al@17082 26 2) tazbox locale; exit 0 ;;
al@17082 27 1) exit 0 ;;
al@17082 28 esac
al@17082 29
al@17081 30 busybox wget -U "$(cd $INSTALLED; ls -1 | tr '\n' ' ')" \
al@17082 31 "http://cook.slitaz.org/tramys2.cgi?lang=$LANG&rel=$(cat /etc/slitaz-release)" \
al@17082 32 -O - | tee $LOG | \
al@17082 33 yad $YADCONF --title="tramys (2/3)" --progress --width=320 --text="$(_ \
al@17082 34 'The server processes the request.
al@17082 35 Please wait.')" \
al@17082 36 --enable-log --log-expanded \
al@17082 37 --button "gtk-cancel:1" --button "gtk-go-forward:0"
al@17082 38 case $? in
al@17082 39 1) exit 0 ;;
al@17082 40 esac
al@17082 41
al@17082 42 DLKEY=$(tail -n1 $LOG); rm -f $LOG
al@17082 43
al@17082 44 busybox wget "http://cook.slitaz.org/tramys2.cgi?dl=$DLKEY" -O $TGZ 2>&1 | \
al@17082 45 yad $YADCONF --title="tramys (3/3)" --progress --pulsate --width=320 \
al@17082 46 --text="$(_ \
al@17082 47 'Downloading in progress.
al@17082 48 Please wait.')" \
al@17082 49 --button "gtk-cancel:1" --button "gtk-ok:0"
al@17082 50 case $? in
al@17082 51 1) exit 0 ;;
al@17082 52 esac | \
al@17082 53
al@17082 54 busybox tar -xz -C $WORKING -f $TGZ
al@17081 55 chown -R root:root $WORKING
al@17081 56 cp -fpr $WORKING/* /
al@17082 57 rm -f $TGZ
al@17081 58 rm -rf $WORKING
al@17082 59
al@17082 60 yad $YADCONF --title="tramys" --text="$(_ \
al@17082 61 'Translation files have been installed in your system.')"