tazpkg diff tazpkg-notify @ rev 840
Add a bunch of modules with new-style support of 'root' (not all commands are modules yet); strip and compress resources.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Aug 28 16:10:34 2015 +0300 (2015-08-28) |
parents | 636b4e8dcf6a |
children | 21ac83abe572 |
line diff
1.1 --- a/tazpkg-notify Wed Apr 08 10:05:00 2015 +0200 1.2 +++ b/tazpkg-notify Fri Aug 28 16:10:34 2015 +0300 1.3 @@ -1,43 +1,35 @@ 1.4 #!/bin/sh 1.5 -# 1.6 -# TazPkg Notify - Notification icon for TazPkg packages. Recharging pkgs 1.7 -# list can be done automatically at boot, so notifies users if some 1.8 -# updates are available. Also notifies users if the packages list is too 1.9 +# TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg 1.10 +# tazpkg-notify - part of TazPkg 1.11 +# Notification icon for TazPkg packages 1.12 + 1.13 +# Recharging pkgs list can be done automatically at boot, so notifies users 1.14 +# if some updates are available. Also notifies users if the packages list is too 1.15 # old and out-of-date or if no packages list found. This script should 1.16 # be run by the WM autostart script or ~/.xsession and needs a systray to 1.17 # sit in like in LXpanel or Tint2. 1.18 -# 1.19 -# Copyright (C) 2012-2014 SliTaz GNU/Linux - GNU GPL v2 1.20 -# 1.21 -# Authors : Christophe Lincoln <pankso@slitaz.org> 1.22 -# 1.23 + 1.24 +# Copyright (C) 2012-2015 SliTaz - GNU General Public License v3. 1.25 +# Authors: See the AUTHORS files 1.26 + 1.27 1.28 . /lib/libtaz.sh 1.29 . /etc/slitaz/slitaz.conf 1.30 1.31 # I18n 1.32 export TEXTDOMAIN='tazpkg' 1.33 -_() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; echo; } 1.34 -_n() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; } 1.35 -_p() { 1.36 - local S="$1" P="$2" N="$3"; shift; shift; shift; 1.37 - printf "$(ngettext "$S" "$P" "$N")" "$@"; } 1.38 - 1.39 1.40 fifo=/tmp/$(basename $0).fifo 1.41 -tazweb="tazweb --notoolbar" 1.42 -panelbase="http://tazpanel:82/pkgs.cgi" 1.43 -panel="http://tazpanel:82/user/pkgs.cgi" 1.44 doc="file:///usr/share/doc/tazpkg/tazpkg.html" 1.45 1.46 -installed=$(wc -l < $PKGS_DB/installed.info) 1.47 +installed=$(wc -l < "$PKGS_DB/installed.info") 1.48 text="$(_p \ 1.49 '%s installed package' \ 1.50 - '%s installed packages' $installed \ 1.51 + '%s installed packages' "$installed" \ 1.52 "<b>$installed</b>")" 1.53 1.54 -[ -f "$PKGS_DB/packages.list" ] && mtime=$(find $PKGS_DB/packages.list -mtime +10;) 1.55 -up=0; [ -f "$PKGS_DB/packages.up" ] && up=$(cat $PKGS_DB/packages.up | wc -l) 1.56 +[ -f "$PKGS_DB/IDs" ] && mtime=$(find "$PKGS_DB/IDs" -mtime +10;) 1.57 +up=0; [ -f "$PKGS_DB/packages.up" ] && up=$(wc -l < "$PKGS_DB/packages.up") 1.58 1.59 1.60 # Notification icon 1.61 @@ -63,11 +55,11 @@ 1.62 menu() { 1.63 cat << EOT 1.64 menu:\ 1.65 -$(_n 'My packages' )!$tazweb $panelbase?list!TazPkg|\ 1.66 -$(_n 'Recharge lists' )!$tazweb $panel?recharge!tazpkg-up|\ 1.67 -$(_n 'Check upgrade' )!$tazweb $panel?up!tazpkg-up|\ 1.68 +$(_n 'My packages' )!tazpanel pkgs#list!TazPkg|\ 1.69 +$(_n 'Recharge lists' )!tazbox su tazpanel pkgs#recharge!tazpkg-up|\ 1.70 +$(_n 'Check upgrade' )!tazbox su tazpanel pkgs#up!tazpkg-up|\ 1.71 $(_n 'TazPkg SHell' )!terminal -e tazpkg shell!utilities-terminal|\ 1.72 -$(_n 'TazPkg manual' )!$tazweb $doc!slitaz-doc|\ 1.73 +$(_n 'TazPkg manual' )!tazweb --notoolbar $doc!slitaz-doc|\ 1.74 $(_n 'Close notification')!quit!gtk-close 1.75 EOT 1.76 } 1.77 @@ -87,18 +79,19 @@ 1.78 sleep 6 1.79 1.80 # Missing packages list 1.81 - if [ ! -f $PKGS_DB/packages.list ]; then 1.82 + if [ ! -f "$PKGS_DB/packages.info" ]; then 1.83 tooltip="$(_ 'No packages list found - %s' "$text")" 1.84 - (echo "action:$tazweb $panel?recharge" 1.85 + (echo "action:tazbox su tazpanel pkgs#recharge" 1.86 echo "tooltip:$tooltip" 1.87 echo "icon:tazpkg-up") > $fifo 1.88 exit 0 1.89 fi 1.90 1.91 # Too old packages list 1.92 - if [ "$mtime" ]; then 1.93 + if [ -n "$mtime" ]; then 1.94 tooltip="$(_ 'Your packages list is older than 10 days')" 1.95 - (echo "action:$tazweb $panel?recharge" 1.96 + (echo "action:tazbox su tazpanel pkgs#recharge" 1.97 + echo "action:quit" 1.98 echo "tooltip:$tooltip" 1.99 echo "icon:tazpkg-up") > $fifo 1.100 exit 0 1.101 @@ -108,9 +101,9 @@ 1.102 if [ "$up" -gt 0 ]; then 1.103 tooltip="$(_p \ 1.104 'There is %s upgradeable package' \ 1.105 - 'There are %s upgradeable packages' $up \ 1.106 + 'There are %s upgradeable packages' "$up" \ 1.107 "<b>$up</b>")" 1.108 - (echo "action:$tazweb $panel?up" 1.109 + (echo "action:tazbox su tazpanel pkgs#up" 1.110 echo "tooltip:$tooltip" 1.111 echo "icon:tazpkg-up") > $fifo 1.112 exit 0