tazpkg rev 710

Makefile: move icons to icons (i.e. clean pixmaps); tazpkg: typo; tazpkg-notify: fix messages.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Dec 15 03:27:27 2014 +0200 (2014-12-15)
parents ed9475337912
children 63fb1f016ece
files Makefile README tazpkg tazpkg-notify
line diff
     1.1 --- a/Makefile	Sun Dec 14 15:08:25 2014 +0000
     1.2 +++ b/Makefile	Mon Dec 15 03:27:27 2014 +0200
     1.3 @@ -7,6 +7,7 @@
     1.4  LINGUAS?=el es fr pl pt_BR ru sv zh_CN zh_TW
     1.5  
     1.6  VERSION:=$(shell grep ^VERSION=[0-9] tazpkg | cut -d '=' -f 2)
     1.7 +ICONS = $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32
     1.8  
     1.9  tmpdir = tar-install/tazpkg-$(VERSION)
    1.10  tarball = tazpkg-$(VERSION).tar.gz
    1.11 @@ -79,7 +80,15 @@
    1.12  	mkdir -p           $(DESTDIR)$(PREFIX)/share
    1.13  	cp -a applications $(DESTDIR)$(PREFIX)/share
    1.14  	#cp -a mime         $(DESTDIR)$(PREFIX)/share # moved to shared-mime-info package
    1.15 -	cp -a pixmaps      $(DESTDIR)$(PREFIX)/share
    1.16 +
    1.17 +	# Default icons
    1.18 +	install -m 0755 -d $(ICONS)/apps
    1.19 +	install -m 0644 pixmaps/tazpkg.png $(ICONS)/apps
    1.20 +	ln -fs tazpkg.png $(ICONS)/apps/TazPkg.png # icon for Yad
    1.21 +	install -m 0755 -d $(ICONS)/actions
    1.22 +	install -m 0644 pixmaps/tazpkg-up.png $(ICONS)/actions
    1.23 +	install -m 0755 -d $(ICONS)/status
    1.24 +	install -m 0644 pixmaps/tazpkg-installed.png $(ICONS)/status
    1.25  
    1.26  	# TazPkg Notify XDG autostart
    1.27  	mkdir -p            $(DESTDIR)/etc/xdg
    1.28 @@ -108,7 +117,9 @@
    1.29  	rm -f  $(DESTDIR)$(PREFIX)/share/applications/tazpkg-*.desktop
    1.30  	rm -f  $(DESTDIR)$(PREFIX)/share/applications/tazpanel-pkgs.desktop
    1.31  
    1.32 -	rm -f  $(DESTDIR)$(PREFIX)/share/pixmaps/tazpkg*.png
    1.33 +	rm -f  $(ICONS)/apps/tazpkg.png
    1.34 +	rm -f  $(ICONS)/actions/tazpkg-up.png
    1.35 +	rm -f  $(ICONS)/status/tazpkg-installed.png
    1.36  
    1.37  	rm -f  $(DESTDIR)/etc/xdg/autostart/tazpkg-notify.desktop
    1.38  
     2.1 --- a/README	Sun Dec 14 15:08:25 2014 +0000
     2.2 +++ b/README	Mon Dec 15 03:27:27 2014 +0200
     2.3 @@ -1,4 +1,4 @@
     2.4 -README for TazPKG -  Tiny autonomous packages manager
     2.5 +README for TazPkg -  Tiny autonomous packages manager
     2.6  ===============================================================================
     2.7  
     2.8  
     3.1 --- a/tazpkg	Sun Dec 14 15:08:25 2014 +0000
     3.2 +++ b/tazpkg	Mon Dec 15 03:27:27 2014 +0200
     3.3 @@ -2241,7 +2241,7 @@
     3.4  			else
     3.5  				footer "$(longline "$(_ "Last %s is ready to use. Note that \
     3.6  next time you recharge the list, a list of differences will be displayed to \
     3.7 -show new and upgradeable packages.") packages.list")"
     3.8 +show new and upgradeable packages." packages.list)")"
     3.9  			fi
    3.10  		done ;;
    3.11  
     4.1 --- a/tazpkg-notify	Sun Dec 14 15:08:25 2014 +0000
     4.2 +++ b/tazpkg-notify	Mon Dec 15 03:27:27 2014 +0200
     4.3 @@ -12,35 +12,45 @@
     4.4  # Authors : Christophe Lincoln <pankso@slitaz.org>
     4.5  #
     4.6  
     4.7 +. /lib/libtaz.sh
     4.8 +. /etc/slitaz/slitaz.conf
     4.9 +
    4.10  # I18n
    4.11 -. /lib/libtaz.sh
    4.12  export TEXTDOMAIN='tazpkg'
    4.13 +_()  { local T="$1"; shift; printf "$(gettext "$T")" "$@"; echo; }
    4.14 +_n() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; }
    4.15 +_p() {
    4.16 +	local S="$1" P="$2" N="$3"; shift; shift; shift;
    4.17 +	printf "$(ngettext "$S" "$P" "$N")" "$@"; }
    4.18 +
    4.19  
    4.20  fifo=/tmp/$(basename $0).fifo
    4.21  panel="http://tazpanel:82/pkgs.cgi"
    4.22 -db="/var/lib/tazpkg"
    4.23  doc="file:///usr/share/doc/tazpkg/tazpkg.html"
    4.24  
    4.25 -installed=$(ls $db/installed | wc -l)
    4.26 +installed=$(wc -l < $PKGS_DB/installed.info)
    4.27  text="$(_p \
    4.28  		'%s installed package' \
    4.29  		'%s installed packages' $installed \
    4.30  		"<b>$installed</b>")"
    4.31 -icon="/usr/share/pixmaps/tazpkg.png"
    4.32 -[ -f "$db/packages.list" ] && mtime=$(find $db/packages.list -mtime +10;)
    4.33 -[ -f "$db/packages.up" ] && up=$(cat $db/packages.up | wc -l)
    4.34 +
    4.35 +[ -f "$PKGS_DB/packages.list" ] && mtime=$(find $PKGS_DB/packages.list -mtime +10;)
    4.36 +up=0; [ -f "$PKGS_DB/packages.up" ] && up=$(cat $PKGS_DB/packages.up | wc -l)
    4.37  
    4.38  
    4.39  # Notification icon
    4.40  
    4.41  listen() {
    4.42  	# Manage the I/O redirection from SHell
    4.43 -	rm -f $fifo && mkfifo $fifo
    4.44 +	rm -f $fifo; mkfifo $fifo
    4.45 +
    4.46  	# Attach a file descriptor
    4.47  	exec 3<> $fifo
    4.48 +
    4.49  	# Notification icon
    4.50 -	yad --notification --listen --image=$icon \
    4.51 -		--text="$(_ 'Checking packages lists - %s' $text)" <&3
    4.52 +	yad --notification --listen --image='TazPkg' \
    4.53 +		--text="$(_ 'Checking packages lists - %s' "$text")" <&3
    4.54 +
    4.55  	# Clean-up
    4.56  	rm -f $fifo
    4.57  }
    4.58 @@ -51,19 +61,19 @@
    4.59  menu() {
    4.60  	cat << EOT
    4.61  menu:\
    4.62 -$(_ 'My packages'       )!tazweb $panel?list!tazpkg|\
    4.63 -$(_ 'Recharge lists'    )!tazweb $panel?recharge!tazpkg-up|\
    4.64 -$(_ 'Check upgrade'     )!tazweb $panel?up!tazpkg-up|\
    4.65 -$(_ 'TazPkg SHell'      )!terminal -e tazpkg shell!xterm|\
    4.66 -$(_ 'TazPkg manual'     )!tazweb $doc!text-html|\
    4.67 -$(_ 'Close notification')!quit!gtk-close
    4.68 +$(_n 'My packages'       )!tazweb $panel?list!TazPkg|\
    4.69 +$(_n 'Recharge lists'    )!tazweb $panel?recharge!tazpkg-up|\
    4.70 +$(_n 'Check upgrade'     )!tazweb $panel?up!tazpkg-up|\
    4.71 +$(_n 'TazPkg SHell'      )!terminal -e tazpkg shell!utilities-terminal|\
    4.72 +$(_n 'TazPkg manual'     )!tazweb $doc!slitaz-doc|\
    4.73 +$(_n 'Close notification')!quit!gtk-close
    4.74  EOT
    4.75  }
    4.76  
    4.77  
    4.78  case $1 in
    4.79  	usage|help|*-h)
    4.80 -		_ "Usage:"; echo " $(basename $0)"
    4.81 +		_n "Usage:"; echo " $(basename $0)"
    4.82  		;;
    4.83  	*)
    4.84  		# Sleep before displaying the notification icon and
    4.85 @@ -73,35 +83,39 @@
    4.86  		sleep 2
    4.87  		menu > $fifo
    4.88  		sleep 6
    4.89 +
    4.90  		# Missing packages list
    4.91 -		if [ ! -f $db/packages.list ]; then
    4.92 -			tooltip="$(_ 'No packages list found - %s' $text)"
    4.93 -			echo "action:tazweb $panel?recharge" > $fifo
    4.94 -			echo "tooltip:$tooltip" > $fifo
    4.95 -			echo "icon:tazpkg-up" > $fifo
    4.96 +		if [ ! -f $PKGS_DB/packages.list ]; then
    4.97 +			tooltip="$(_ 'No packages list found - %s' "$text")"
    4.98 +			(echo "action:tazweb $panel?recharge"
    4.99 +			 echo "tooltip:$tooltip"
   4.100 +			 echo "icon:tazpkg-up") > $fifo
   4.101  			exit 0
   4.102  		fi
   4.103 +
   4.104  		# Too old packages list
   4.105  		if [ "$mtime" ]; then
   4.106  			tooltip="$(_ 'Your packages list is older than 10 days')"
   4.107 -			echo "action:tazweb $panel?recharge" > $fifo
   4.108 -			echo "tooltip:$tooltip" > $fifo
   4.109 -			echo "icon:tazpkg-up" > $fifo
   4.110 +			(echo "action:tazweb $panel?recharge"
   4.111 +			 echo "tooltip:$tooltip"
   4.112 +			 echo "icon:tazpkg-up") > $fifo
   4.113  			exit 0
   4.114  		fi
   4.115 +
   4.116  		# Available upgrades
   4.117  		if [ "$up" -gt 0 ]; then
   4.118  			tooltip="$(_p \
   4.119  				'There is %s upgradeable package' \
   4.120  				'There are %s upgradeable packages' $up \
   4.121  				"<b>$up</b>")"
   4.122 -			echo "action:tazweb $panel?up" > $fifo
   4.123 -			echo "tooltip:$tooltip" > $fifo
   4.124 -			echo "icon:tazpkg-up" > $fifo
   4.125 +			(echo "action:tazweb $panel?up"
   4.126 +			 echo "tooltip:$tooltip"
   4.127 +			 echo "icon:tazpkg-up") > $fifo
   4.128  			exit 0
   4.129  		fi
   4.130 +
   4.131  		# Nothing to do, close notification
   4.132 -		tooltip="$(_ 'System is up to date - %s' $text)"
   4.133 +		tooltip="$(_ 'System is up to date - %s' "$text")"
   4.134  		echo "tooltip:$tooltip" > $fifo
   4.135  		sleep 10
   4.136  		echo "quit" > $fifo