# HG changeset patch # User Aleksej Bobylev # Date 1408909619 -10800 # Node ID 24e0f312c73de5e7add94955e831a3689ccab3bc # Parent 096a77a2021da52e8bc5f7874d851cd457307ae8 Up: tramys-server and tramys-client (140824). diff -r 096a77a2021d -r 24e0f312c73d tramys-client/receipt --- a/tramys-client/receipt Sun Aug 24 22:43:01 2014 +0300 +++ b/tramys-client/receipt Sun Aug 24 22:46:59 2014 +0300 @@ -1,15 +1,19 @@ # SliTaz package receipt. PACKAGE="tramys-client" -VERSION="140823" +VERSION="140824" CATEGORY="system-tools" SHORT_DESC="Tool for managing translation files for SliTaz GNU/Linux, client part" MAINTAINER="al.bobylev@gmail.com" LICENSE="GPL" WEB_SITE="http://www.slitaz.org/" +DEPENDS="yad" + # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { install -Dm755 -o root $stuff/tramys2 $fs/usr/bin/tramys2 + install -Dm644 -o root $stuff/tramys2.desktop \ + $fs/usr/share/applications/tramys2.desktop } diff -r 096a77a2021d -r 24e0f312c73d tramys-client/stuff/tramys2 --- a/tramys-client/stuff/tramys2 Sun Aug 24 22:43:01 2014 +0300 +++ b/tramys-client/stuff/tramys2 Sun Aug 24 22:46:59 2014 +0300 @@ -5,11 +5,57 @@ . /etc/slitaz/slitaz.conf . /lib/libtaz.sh -check_root $@ + +if [ $(id -u) != 0 ]; then + exec tazbox su $0 $@; exit 0 +fi + +export TEXTDOMAIN='tramys' # i18n WORKING=$(mktemp -d) +LOG="/tmp/tramys.log" +TGZ="/tmp/tramys.tgz" +YADCONF="--center --window-icon=config-language --image=config-language --image-on-top" + +yad $YADCONF --title="tramys (1/3)" --text="$(_ \ +'Now translations for all installed programs will be found and downloaded. +You can change locale if you want, or proceed. + +Your current locale: $LANG')" \ + --button "gtk-edit:2" --button "gtk-cancel:1" --button "gtk-go-forward:0" +case $? in + 2) tazbox locale; exit 0 ;; + 1) exit 0 ;; +esac + busybox wget -U "$(cd $INSTALLED; ls -1 | tr '\n' ' ')" \ - "http://cook.slitaz.org/tramys.cgi?lang=$LANG" -O - | \ - busybox tar -C $WORKING -xz + "http://cook.slitaz.org/tramys2.cgi?lang=$LANG&rel=$(cat /etc/slitaz-release)" \ + -O - | tee $LOG | \ + yad $YADCONF --title="tramys (2/3)" --progress --width=320 --text="$(_ \ +'The server processes the request. +Please wait.')" \ + --enable-log --log-expanded \ + --button "gtk-cancel:1" --button "gtk-go-forward:0" +case $? in + 1) exit 0 ;; +esac + +DLKEY=$(tail -n1 $LOG); rm -f $LOG + +busybox wget "http://cook.slitaz.org/tramys2.cgi?dl=$DLKEY" -O $TGZ 2>&1 | \ +yad $YADCONF --title="tramys (3/3)" --progress --pulsate --width=320 \ + --text="$(_ \ +'Downloading in progress. +Please wait.')" \ + --button "gtk-cancel:1" --button "gtk-ok:0" +case $? in + 1) exit 0 ;; +esac | \ + +busybox tar -xz -C $WORKING -f $TGZ chown -R root:root $WORKING cp -fpr $WORKING/* / +rm -f $TGZ rm -rf $WORKING + +yad $YADCONF --title="tramys" --text="$(_ \ +'Translation files have been installed in your system.')" diff -r 096a77a2021d -r 24e0f312c73d tramys-client/stuff/tramys2.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tramys-client/stuff/tramys2.desktop Sun Aug 24 22:46:59 2014 +0300 @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=tramys +Comment=Translate My SliTaz! +Exec=tramys2 +Icon=config-language +Categories=GTK;Settings;DesktopSettings; diff -r 096a77a2021d -r 24e0f312c73d tramys-server/receipt --- a/tramys-server/receipt Sun Aug 24 22:43:01 2014 +0300 +++ b/tramys-server/receipt Sun Aug 24 22:46:59 2014 +0300 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="tramys-server" -VERSION="140822" +VERSION="140824" CATEGORY="system-tools" SHORT_DESC="Tool for managing translation files for SliTaz GNU/Linux, server part" MAINTAINER="al.bobylev@gmail.com" diff -r 096a77a2021d -r 24e0f312c73d tramys-server/stuff/tramys.cgi --- a/tramys-server/stuff/tramys.cgi Sun Aug 24 22:43:01 2014 +0300 +++ b/tramys-server/stuff/tramys.cgi Sun Aug 24 22:46:59 2014 +0300 @@ -3,15 +3,39 @@ # Tool for managing translation files for SliTaz GNU/Linux # Aleksej Bobylev , 2014 -# How to use: tramys.cgi?lang=$LANG +# How to use: +# 1. tramys2.cgi?lang=$LANG&rel=$RELEASE to generate archive # Pass packages list in HTTP_USER_AGENT header # (seems it have no restrictions for length and no encoded symbols ' ' and '+') +# 2. tramys2.cgi?dl=$DL_KEY to download archive (user can cancel downloading) . /usr/bin/httpd_helper.sh WORKING=$(mktemp -d) DATADIR=/home/lexeii/Public/tramys +# hide script +if [ "x$(GET lang)$(GET rel)$(GET dl)" == "x" ]; then + echo -e "HTTP/1.1 404 Not Found\nContent-Type: text/html\n\n404 - Not Found

404 - Not Found

" + exit +fi + +# begin: compress and give to client +if [ "x$(GET dl)" != "x" ]; then + WORKING="/tmp/tmp.$(echo $(GET dl) | tr -cd 'A-Za-z0-9')" # avoid relative paths + cat <