wok-6.x rev 17081
Add: tramys-server and tramys-client (yesterday version for history).
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sun Aug 24 22:43:01 2014 +0300 (2014-08-24) |
parents | 633aff33b052 |
children | 24e0f312c73d |
files | tramys-client/receipt tramys-client/stuff/tramys2 tramys-server/receipt tramys-server/stuff/tramys.cgi |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tramys-client/receipt Sun Aug 24 22:43:01 2014 +0300 1.3 @@ -0,0 +1,15 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="tramys-client" 1.7 +VERSION="140823" 1.8 +CATEGORY="system-tools" 1.9 +SHORT_DESC="Tool for managing translation files for SliTaz GNU/Linux, client part" 1.10 +MAINTAINER="al.bobylev@gmail.com" 1.11 +LICENSE="GPL" 1.12 +WEB_SITE="http://www.slitaz.org/" 1.13 + 1.14 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.15 +genpkg_rules() 1.16 +{ 1.17 + install -Dm755 -o root $stuff/tramys2 $fs/usr/bin/tramys2 1.18 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tramys-client/stuff/tramys2 Sun Aug 24 22:43:01 2014 +0300 2.3 @@ -0,0 +1,15 @@ 2.4 +#!/bin/sh 2.5 +# tramys - TRAnslate MY Slitaz. Client solution 2.6 +# Tool for managing translation files for SliTaz GNU/Linux 2.7 +# Aleksej Bobylev <al.bobylev@gmail.com>, 2014 2.8 + 2.9 +. /etc/slitaz/slitaz.conf 2.10 +. /lib/libtaz.sh 2.11 +check_root $@ 2.12 +WORKING=$(mktemp -d) 2.13 +busybox wget -U "$(cd $INSTALLED; ls -1 | tr '\n' ' ')" \ 2.14 + "http://cook.slitaz.org/tramys.cgi?lang=$LANG" -O - | \ 2.15 + busybox tar -C $WORKING -xz 2.16 +chown -R root:root $WORKING 2.17 +cp -fpr $WORKING/* / 2.18 +rm -rf $WORKING
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tramys-server/receipt Sun Aug 24 22:43:01 2014 +0300 3.3 @@ -0,0 +1,18 @@ 3.4 +# SliTaz package receipt. 3.5 + 3.6 +PACKAGE="tramys-server" 3.7 +VERSION="140822" 3.8 +CATEGORY="system-tools" 3.9 +SHORT_DESC="Tool for managing translation files for SliTaz GNU/Linux, server part" 3.10 +MAINTAINER="al.bobylev@gmail.com" 3.11 +LICENSE="GPL" 3.12 +WEB_SITE="http://www.slitaz.org/" 3.13 + 3.14 +DEPENDS="tramys" 3.15 + 3.16 +# Rules to gen a SliTaz package suitable for Tazpkg. 3.17 +genpkg_rules() 3.18 +{ 3.19 + install -Dm755 -o www -g www $stuff/tramys.cgi \ 3.20 + $fs/home/slitaz/www/cook/tramys.cgi 3.21 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tramys-server/stuff/tramys.cgi Sun Aug 24 22:43:01 2014 +0300 4.3 @@ -0,0 +1,87 @@ 4.4 +#!/bin/sh 4.5 +# tramys - TRAnslate MY Slitaz. Server solution 4.6 +# Tool for managing translation files for SliTaz GNU/Linux 4.7 +# Aleksej Bobylev <al.bobylev@gmail.com>, 2014 4.8 + 4.9 +# How to use: tramys.cgi?lang=$LANG 4.10 +# Pass packages list in HTTP_USER_AGENT header 4.11 +# (seems it have no restrictions for length and no encoded symbols ' ' and '+') 4.12 + 4.13 +. /usr/bin/httpd_helper.sh 4.14 + 4.15 +WORKING=$(mktemp -d) 4.16 +DATADIR=/home/lexeii/Public/tramys 4.17 + 4.18 +# prepare list for search 4.19 +# original GNU gettext searches precisely in this order 4.20 +locales_list() { 4.21 + LL=$(echo $1 | sed 's|^\([^_.@]*\).*$|\1|') 4.22 + CC=$(echo $1 | sed -n '/_/s|^[^_]*\(_[^.@]*\).*$|\1|p') 4.23 + EE=$(echo $1 | sed -n '/./s|^[^\.]*\(\.[^@]*\).*$|\1|p') 4.24 + VV=$(echo $1 | sed -n '/@/s|^[^@]*\(@.*\)$|\1|p') 4.25 + ee=$(echo $EE | tr A-Z a-z | tr -cd a-z0-9); [ "$ee" ] && ee=.$ee 4.26 + [ "x$EE" == "x$ee" ] && ee='' 4.27 + 4.28 + [ "$CC" -a "$EE" -a "$VV" ] && echo -n "$LL$CC$EE$VV " 4.29 + [ "$CC" -a "$ee" -a "$VV" ] && echo -n "$LL$CC$ee$VV " 4.30 + [ "$CC" -a "$VV" ] && echo -n "$LL$CC$VV " 4.31 + [ "$EE" -a "$VV" ] && echo -n "$LL$EE$VV " 4.32 + [ "$ee" -a "$VV" ] && echo -n "$LL$ee$VV " 4.33 + [ "$VV" ] && echo -n "$LL$VV " 4.34 + [ "$CC" -a "$EE" ] && echo -n "$LL$CC$EE " 4.35 + [ "$CC" -a "$ee" ] && echo -n "$LL$CC$ee " 4.36 + [ "$CC" ] && echo -n "$LL$CC " 4.37 + [ "$EE" ] && echo -n "$LL$EE " 4.38 + [ "$ee" ] && echo -n "$LL$ee " 4.39 + echo "$LL" 4.40 +} 4.41 +MY_LOCALES=$(locales_list $(GET lang)) 4.42 + 4.43 +# constants to use in lists 4.44 +US="/usr/share" 4.45 +LC="LC_MESSAGES" 4.46 +PY="/usr/lib/python2.7/site-packages" 4.47 +R="/usr/lib/R/library" 4.48 +RT="$R/translations/%/$LC" 4.49 + 4.50 +for P in $HTTP_USER_AGENT; do 4.51 + 4.52 + for list_type in mo qm; do 4.53 + IFS=$'\n' 4.54 + for line in $(grep -e "^$P " $DATADIR/$list_type.list); do 4.55 + locales=$(echo $line | cut -d' ' -f2) 4.56 + names=$(echo $line | cut -d' ' -f3) 4.57 + [ "x$names" == "x" ] && names=$P 4.58 + pathes=$(echo $line | cut -d' ' -f4) 4.59 + [ "x$pathes" == "x" ] && pathes="$US/locale/%/$LC" 4.60 + 4.61 + IFS=' ' 4.62 + for locale in $MY_LOCALES; do 4.63 + if $(echo " $locales " | grep -q " $locale "); then 4.64 + 4.65 + for name in $names; do 4.66 + for path in $pathes; do 4.67 + eval "fullname=${path//%/$locale}/${name//%/$locale}.$list_type" 4.68 + mkdir -p $WORKING$(dirname $fullname) 4.69 + cp -pf /home/slitaz/cooking/chroot/home/slitaz/wok/$P/install$fullname \ 4.70 + $WORKING$fullname 4.71 + done 4.72 + done 4.73 + break 4.74 + fi 4.75 + done 4.76 + done 4.77 + done 4.78 +done 4.79 + 4.80 +busybox tar -czf $WORKING.tgz -C $WORKING . 4.81 +cat <<EOT 4.82 +Content-Type: application/x-compressed-tar 4.83 +Content-Length: $(stat -c %s $WORKING.tgz) 4.84 +Content-Disposition: attachment; filename=tramys.tgz 4.85 + 4.86 +EOT 4.87 +cat $WORKING.tgz 4.88 + 4.89 +rm -rf $WORKING 4.90 +rm -f $WORKING.tgz