tazpkg view tazpkg-box @ rev 593
Disable multi pkg install, it's not well implemented
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Apr 14 19:08:47 2012 +0200 (2012-04-14) |
parents | 7d8d81c885c3 |
children | 90038f19958b |
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 title=$(gettext "TazPKG Action")
13 icon="/usr/share/pixmaps/tazpkg.png"
14 opts="--image=tazpkg --image-on-top --width=520 --center --on-top"
16 # Nice GTK output for install and extract.
17 output() {
18 yad --text-info $opts --text="<b>$title</b>" \
19 --height=260 --title="$title" --window-icon=$icon \
20 --tail --margins=4 --button="gtk-close:0"
21 }
23 # Main GUI box function with pure Yad spec
24 actions_main() {
25 text=$(gettext "Package name:")
26 yad --text="$text <b>${pkg%.tazpkg}</b>" $opts \
27 --title="$title" --height=100 \
28 --window-icon=$icon --image-on-top \
29 --button="Install:3" --button="Extract:2" \
30 --button="gtk-close:1"
31 }
33 # Actions user can do when clicking on a package.
34 actions() {
35 # Store box results
36 main=$(actions_main)
37 ret=$?
38 # Deal with --button values
39 case $ret in
40 1) exit 0 ;;
41 2) tazpkg extract $pkg | output ;;
42 3) tazpkg -i $pkg --forced | output ;;
43 esac
44 }
46 # TazPKG URL Handler.
47 dl_inst() {
48 pkg=$(basename $url)
49 gettext "Downloading: $pkg"; echo -e "\n"
50 cd /tmp && wget $url 2>&1
51 tazpkg -i $pkg --forced 2>&1
52 rm -f $pkg
53 }
55 #
56 # Script commands
57 #
59 case "$1" in
60 usage|help|-u|-h)
61 echo "Usage: $(basename $0) [actions|url] [pkg]" ;;
62 tazpkg://*)
63 # TazPKG URL's handler.
64 url="http://${1#tazpkg://}"
65 dl_inst | output ;;
66 actions)
67 pkg=$(basename $2)
68 cd $(dirname $2)
69 actions ;;
70 esac
72 exit 0