wok 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 | d4450804a65f |
files | tramys-client/receipt tramys-client/stuff/tramys2 tramys-client/stuff/tramys2.desktop tramys-server/receipt tramys-server/stuff/tramys.cgi |
line diff
1.1 --- a/tramys-client/receipt Sun Aug 24 22:43:01 2014 +0300 1.2 +++ b/tramys-client/receipt Sun Aug 24 22:46:59 2014 +0300 1.3 @@ -1,15 +1,19 @@ 1.4 # SliTaz package receipt. 1.5 1.6 PACKAGE="tramys-client" 1.7 -VERSION="140823" 1.8 +VERSION="140824" 1.9 CATEGORY="system-tools" 1.10 SHORT_DESC="Tool for managing translation files for SliTaz GNU/Linux, client part" 1.11 MAINTAINER="al.bobylev@gmail.com" 1.12 LICENSE="GPL" 1.13 WEB_SITE="http://www.slitaz.org/" 1.14 1.15 +DEPENDS="yad" 1.16 + 1.17 # Rules to gen a SliTaz package suitable for Tazpkg. 1.18 genpkg_rules() 1.19 { 1.20 install -Dm755 -o root $stuff/tramys2 $fs/usr/bin/tramys2 1.21 + install -Dm644 -o root $stuff/tramys2.desktop \ 1.22 + $fs/usr/share/applications/tramys2.desktop 1.23 }
2.1 --- a/tramys-client/stuff/tramys2 Sun Aug 24 22:43:01 2014 +0300 2.2 +++ b/tramys-client/stuff/tramys2 Sun Aug 24 22:46:59 2014 +0300 2.3 @@ -5,11 +5,57 @@ 2.4 2.5 . /etc/slitaz/slitaz.conf 2.6 . /lib/libtaz.sh 2.7 -check_root $@ 2.8 + 2.9 +if [ $(id -u) != 0 ]; then 2.10 + exec tazbox su $0 $@; exit 0 2.11 +fi 2.12 + 2.13 +export TEXTDOMAIN='tramys' # i18n 2.14 WORKING=$(mktemp -d) 2.15 +LOG="/tmp/tramys.log" 2.16 +TGZ="/tmp/tramys.tgz" 2.17 +YADCONF="--center --window-icon=config-language --image=config-language --image-on-top" 2.18 + 2.19 +yad $YADCONF --title="tramys (1/3)" --text="$(_ \ 2.20 +'Now translations for all installed programs will be found and downloaded. 2.21 +You can change locale if you want, or proceed. 2.22 + 2.23 +Your current locale: <b>$LANG</b>')" \ 2.24 + --button "gtk-edit:2" --button "gtk-cancel:1" --button "gtk-go-forward:0" 2.25 +case $? in 2.26 + 2) tazbox locale; exit 0 ;; 2.27 + 1) exit 0 ;; 2.28 +esac 2.29 + 2.30 busybox wget -U "$(cd $INSTALLED; ls -1 | tr '\n' ' ')" \ 2.31 - "http://cook.slitaz.org/tramys.cgi?lang=$LANG" -O - | \ 2.32 - busybox tar -C $WORKING -xz 2.33 + "http://cook.slitaz.org/tramys2.cgi?lang=$LANG&rel=$(cat /etc/slitaz-release)" \ 2.34 + -O - | tee $LOG | \ 2.35 + yad $YADCONF --title="tramys (2/3)" --progress --width=320 --text="$(_ \ 2.36 +'The server processes the request. 2.37 +Please wait.')" \ 2.38 + --enable-log --log-expanded \ 2.39 + --button "gtk-cancel:1" --button "gtk-go-forward:0" 2.40 +case $? in 2.41 + 1) exit 0 ;; 2.42 +esac 2.43 + 2.44 +DLKEY=$(tail -n1 $LOG); rm -f $LOG 2.45 + 2.46 +busybox wget "http://cook.slitaz.org/tramys2.cgi?dl=$DLKEY" -O $TGZ 2>&1 | \ 2.47 +yad $YADCONF --title="tramys (3/3)" --progress --pulsate --width=320 \ 2.48 + --text="$(_ \ 2.49 +'Downloading in progress. 2.50 +Please wait.')" \ 2.51 + --button "gtk-cancel:1" --button "gtk-ok:0" 2.52 +case $? in 2.53 + 1) exit 0 ;; 2.54 +esac | \ 2.55 + 2.56 +busybox tar -xz -C $WORKING -f $TGZ 2.57 chown -R root:root $WORKING 2.58 cp -fpr $WORKING/* / 2.59 +rm -f $TGZ 2.60 rm -rf $WORKING 2.61 + 2.62 +yad $YADCONF --title="tramys" --text="$(_ \ 2.63 +'Translation files have been installed in your system.')"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tramys-client/stuff/tramys2.desktop Sun Aug 24 22:46:59 2014 +0300 3.3 @@ -0,0 +1,7 @@ 3.4 +[Desktop Entry] 3.5 +Type=Application 3.6 +Name=tramys 3.7 +Comment=Translate My SliTaz! 3.8 +Exec=tramys2 3.9 +Icon=config-language 3.10 +Categories=GTK;Settings;DesktopSettings;
4.1 --- a/tramys-server/receipt Sun Aug 24 22:43:01 2014 +0300 4.2 +++ b/tramys-server/receipt Sun Aug 24 22:46:59 2014 +0300 4.3 @@ -1,7 +1,7 @@ 4.4 # SliTaz package receipt. 4.5 4.6 PACKAGE="tramys-server" 4.7 -VERSION="140822" 4.8 +VERSION="140824" 4.9 CATEGORY="system-tools" 4.10 SHORT_DESC="Tool for managing translation files for SliTaz GNU/Linux, server part" 4.11 MAINTAINER="al.bobylev@gmail.com"
5.1 --- a/tramys-server/stuff/tramys.cgi Sun Aug 24 22:43:01 2014 +0300 5.2 +++ b/tramys-server/stuff/tramys.cgi Sun Aug 24 22:46:59 2014 +0300 5.3 @@ -3,15 +3,39 @@ 5.4 # Tool for managing translation files for SliTaz GNU/Linux 5.5 # Aleksej Bobylev <al.bobylev@gmail.com>, 2014 5.6 5.7 -# How to use: tramys.cgi?lang=$LANG 5.8 +# How to use: 5.9 +# 1. tramys2.cgi?lang=$LANG&rel=$RELEASE to generate archive 5.10 # Pass packages list in HTTP_USER_AGENT header 5.11 # (seems it have no restrictions for length and no encoded symbols ' ' and '+') 5.12 +# 2. tramys2.cgi?dl=$DL_KEY to download archive (user can cancel downloading) 5.13 5.14 . /usr/bin/httpd_helper.sh 5.15 5.16 WORKING=$(mktemp -d) 5.17 DATADIR=/home/lexeii/Public/tramys 5.18 5.19 +# hide script 5.20 +if [ "x$(GET lang)$(GET rel)$(GET dl)" == "x" ]; then 5.21 + echo -e "HTTP/1.1 404 Not Found\nContent-Type: text/html\n\n<!DOCTYPE html><html><head><title>404 - Not Found</title></head><body><h1>404 - Not Found</h1></body></html>" 5.22 + exit 5.23 +fi 5.24 + 5.25 +# begin: compress and give to client 5.26 +if [ "x$(GET dl)" != "x" ]; then 5.27 + WORKING="/tmp/tmp.$(echo $(GET dl) | tr -cd 'A-Za-z0-9')" # avoid relative paths 5.28 + cat <<EOT 5.29 +Content-Type: application/x-compressed-tar 5.30 +Content-Length: $(stat -c %s $WORKING.tgz) 5.31 +Content-Disposition: attachment; filename=tramys.tgz 5.32 + 5.33 +EOT 5.34 + cat $WORKING.tgz 5.35 + rm -f $WORKING.tgz 5.36 + exit 0 5.37 +fi 5.38 +# end: compress and give to client 5.39 + 5.40 + 5.41 # prepare list for search 5.42 # original GNU gettext searches precisely in this order 5.43 locales_list() { 5.44 @@ -44,11 +68,29 @@ 5.45 R="/usr/lib/R/library" 5.46 RT="$R/translations/%/$LC" 5.47 5.48 +# supported 4.0 (as stable now) an cooking (rolling, 5.0) 5.49 +# don't know what to do with "arm" and "x86_64" woks 5.50 +case $(GET rel) in 5.51 + 4*) PREFIX="stable"; WOK="stable" ;; 5.52 + *) PREFIX=""; WOK="cooking" ;; 5.53 +esac 5.54 +WOK="/home/slitaz/$WOK/chroot/home/slitaz/wok" 5.55 + 5.56 +PKGNUM=$(echo $HTTP_USER_AGENT | wc -w) 5.57 +NUM=1 5.58 + 5.59 +echo -e "Content-Type: text/plain\n\n" # to Yad client 5.60 +echo "#Number of packages: $PKGNUM" 5.61 +echo "#Searching in progress..." 5.62 + 5.63 for P in $HTTP_USER_AGENT; do 5.64 5.65 + echo "$((100*$NUM/$PKGNUM))" # percentage to Yad client 5.66 + NUM=$(($NUM+1)) 5.67 + 5.68 for list_type in mo qm; do 5.69 IFS=$'\n' 5.70 - for line in $(grep -e "^$P " $DATADIR/$list_type.list); do 5.71 + for line in $(grep -e "^$P " $DATADIR/$PREFIX$list_type.list); do 5.72 locales=$(echo $line | cut -d' ' -f2) 5.73 names=$(echo $line | cut -d' ' -f3) 5.74 [ "x$names" == "x" ] && names=$P 5.75 @@ -63,8 +105,7 @@ 5.76 for path in $pathes; do 5.77 eval "fullname=${path//%/$locale}/${name//%/$locale}.$list_type" 5.78 mkdir -p $WORKING$(dirname $fullname) 5.79 - cp -pf /home/slitaz/cooking/chroot/home/slitaz/wok/$P/install$fullname \ 5.80 - $WORKING$fullname 5.81 + cp -pf $WOK/$P/install$fullname $WORKING$fullname 5.82 done 5.83 done 5.84 break 5.85 @@ -74,14 +115,17 @@ 5.86 done 5.87 done 5.88 5.89 +echo "#" # to Yad client log 5.90 +echo "#Preparing archive. Please wait" 5.91 + 5.92 busybox tar -czf $WORKING.tgz -C $WORKING . 5.93 -cat <<EOT 5.94 -Content-Type: application/x-compressed-tar 5.95 -Content-Length: $(stat -c %s $WORKING.tgz) 5.96 -Content-Disposition: attachment; filename=tramys.tgz 5.97 +rm -rf $WORKING 5.98 5.99 -EOT 5.100 -cat $WORKING.tgz 5.101 +echo "#" # to Yad client log 5.102 +echo "#Done!" 5.103 +echo "#Now you can proceed to downloading" 5.104 +echo "#and installing your translations." 5.105 +echo "#File size: $(stat -c %s $WORKING.tgz)" 5.106 5.107 -rm -rf $WORKING 5.108 -rm -f $WORKING.tgz 5.109 +echo "${WORKING#*.}" # give download key to Yad client 5.110 +exit 0