tazpkg diff tazpkg-box @ rev 657

Added tag 5.2 for changeset f907fd3826f2
author Christophe Lincoln <pankso@slitaz.org>
date Sun Feb 16 14:07:21 2014 +0100 (2014-02-16)
parents 5317ffe7bfbb
children 1ab24812ad7e
line diff
     1.1 --- a/tazpkg-box	Thu Jul 25 01:47:48 2013 +0300
     1.2 +++ b/tazpkg-box	Sun Feb 16 14:07:21 2014 +0100
     1.3 @@ -4,7 +4,7 @@
     1.4  # patch to extract a TazPkg file but not Thunar and other FM. TazPkgBox tries
     1.5  # to follow freedesktop standards.
     1.6  #
     1.7 -# Copyright (C) 2011-2013 SliTaz GNU/Linux - GNU GPL v2
     1.8 +# Copyright (C) 2011-2014 SliTaz GNU/Linux - GNU GPL v2
     1.9  #
    1.10  # Authors: Christophe Lincoln <pankso@slitaz.org>
    1.11  #
    1.12 @@ -14,25 +14,49 @@
    1.13  TEXTDOMAIN='tazpkg'
    1.14  export TEXTDOMAIN
    1.15  
    1.16 -title=$(gettext "TazPkg Action")
    1.17 +title=$(gettext "TazPKG")
    1.18 +text=$(gettext "SliTaz Package Action")
    1.19  icon="/usr/share/pixmaps/tazpkg.png"
    1.20  opts="--image=tazpkg --image-on-top --center --on-top"
    1.21  
    1.22 +usage() {
    1.23 +	cat << EOT
    1.24 +$(gettext 'Usage:') $(basename $0) [actions|URL] [$(gettext 'package')]
    1.25 +EOT
    1.26 +}
    1.27 +
    1.28  # Nice GTK output for install and extract.
    1.29  output() {
    1.30 -	yad --text-info $opts --text="<b>$title</b>" \
    1.31 -		--height=260 --width=520 --title="$title" --window-icon=$icon \
    1.32 +	yad --text-info $opts --title="$title" --text="<b>$text</b>" \
    1.33 +		--height=260 --width=520  --window-icon=$icon \
    1.34  		--tail --margins=4 --button="gtk-close:0"
    1.35  }
    1.36  
    1.37 +pkginfo() {
    1.38 +	tmp=/tmp/$(basename $0)/$$
    1.39 +	mkdir -p $tmp && cd $tmp
    1.40 +	{ cpio --quiet -i receipt > /dev/null 2>&1; } < ${dir}/$pkg
    1.41 +	. $tmp/receipt
    1.42 +	#rm -rf /tmp/$(basename $0)
    1.43 +	size=$(du -sh ${dir}/$pkg | awk '{print $1}')
    1.44 +	echo -e "Package\n$PACKAGE
    1.45 +Version\n$VERSION
    1.46 +Short desc\n$SHORT_DESC
    1.47 +Unpacked size\n$UNPACKED_SIZE
    1.48 +Depends\n$DEPENDS"
    1.49 +}
    1.50 +
    1.51  # Main GUI box function with pure Yad spec
    1.52  actions_main() {
    1.53  	pkgname=${pkg%.tazpkg}
    1.54 -	text=$(eval_gettext 'Package name: <b>$pkgname</b>')
    1.55 -	yad --text="$text" $opts \
    1.56 -		--title="$title" \
    1.57 +	pkginfo | yad $opts --title="$title" \
    1.58 +		--list --no-headers --no-click  \
    1.59 +		--height=260 --width=520 \
    1.60 +		--text="<b>$text</b>" \
    1.61  		--window-icon=$icon \
    1.62 -		--button="$(gettext 'Install'):3" --button="$(gettext 'Extract'):2" \
    1.63 +		--column "Name" --column "" \
    1.64 +		--button="$(gettext 'Install'):3" \
    1.65 +		--button="$(gettext 'Extract'):2" \
    1.66  		--button="gtk-cancel:1"
    1.67  }
    1.68  
    1.69 @@ -64,17 +88,16 @@
    1.70  
    1.71  case "$1" in
    1.72  	usage|help|-u|-h)
    1.73 -		echo "$(gettext 'Usage:') $(basename $0) [actions|$(gettext 'URL')] \
    1.74 -[$(gettext 'package')]" ;;
    1.75 +		usage ;;
    1.76  	tazpkg://*)
    1.77  		# TazPkg URL's handler.
    1.78  		url="http://${1#tazpkg://}"
    1.79  		dl_inst | output ;;
    1.80  	actions)
    1.81  		pkg=$(basename $2)
    1.82 -		cd $(dirname $2)
    1.83 +		dir=$(dirname $2)
    1.84 +		cd $dir
    1.85  		actions ;;
    1.86  esac
    1.87  
    1.88  exit 0
    1.89 -