tazpkg view tazpkg-box @ rev 620

update version number
author border
date Fri Jan 04 17:40:07 2013 -0500 (2013-01-04)
parents 90038f19958b
children 5317ffe7bfbb
line source
1 #!/bin/sh
2 #
3 # Small GTK boxes to TazPKG for deep desktop integration. PcmanFM 0.5.x has a
4 # patch to extract a TazPKG file but not Thunar and other FM. TazPKGbox tries
5 # to follow freedesktop standards.
6 #
7 # Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2
8 #
9 # Authors : Christophe Lincoln <pankso@slitaz.org>
10 #
12 # Internationalization.
13 . /usr/bin/gettext.sh
14 TEXTDOMAIN='tazpkg'
15 export TEXTDOMAIN
17 title=$(gettext "TazPKG Action")
18 icon="/usr/share/pixmaps/tazpkg.png"
19 opts="--image=tazpkg --image-on-top --width=520 --center --on-top"
21 # Nice GTK output for install and extract.
22 output() {
23 yad --text-info $opts --text="<b>$title</b>" \
24 --height=260 --title="$title" --window-icon=$icon \
25 --tail --margins=4 --button="gtk-close:0"
26 }
28 # Main GUI box function with pure Yad spec
29 actions_main() {
30 pkgname=${pkg%.tazpkg}
31 text=$(eval_gettext 'Package name: <b>$pkgname</b>')
32 yad --text="$text" $opts \
33 --title="$title" --height=100 \
34 --window-icon=$icon --image-on-top \
35 --button="$(gettext 'Install'):3" --button="$(gettext 'Extract'):2" \
36 --button="gtk-close:1"
37 }
39 # Actions user can do when clicking on a package.
40 actions() {
41 # Store box results
42 main=$(actions_main)
43 ret=$?
44 # Deal with --button values
45 case $ret in
46 1) exit 0 ;;
47 2) tazpkg extract $pkg . --output="raw" | output ;;
48 3) tazpkg -i $pkg . --forced --output="raw" | output ;;
49 esac
50 }
52 # TazPKG URL Handler.
53 dl_inst() {
54 pkg=$(basename $url)
55 eval_gettext "Downloading: \$pkg"; echo -e "\n"
56 cd /tmp && wget $url 2>&1
57 tazpkg -i $pkg --forced --output="raw" 2>&1
58 rm -f $pkg
59 }
61 #
62 # Script commands
63 #
65 case "$1" in
66 usage|help|-u|-h)
67 progname=$(basename $0)
68 eval_gettext "Usage: \$progname [actions|url] [pkg]" ;;
69 tazpkg://*)
70 # TazPKG URL's handler.
71 url="http://${1#tazpkg://}"
72 dl_inst | output ;;
73 actions)
74 pkg=$(basename $2)
75 cd $(dirname $2)
76 actions ;;
77 esac
79 exit 0