tazpkg view lib/tazpkgbox/package_infos @ rev 87

tazpkgbox: add size for installed packages
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 19 09:59:27 2008 +0000 (2008-05-19)
parents dec437264c66
children ba8155966f13
line source
1 #!/bin/sh
2 #
3 # Dialog box to provide package infos and actions
4 #
6 XTERM_OPTS="-geometry 80x16+120+120"
8 PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
10 # Installed or not installed, that the question.
11 if [ -d /var/lib/tazpkg/installed/$PKG ]; then
12 PACKED_SIZE=""
13 . /var/lib/tazpkg/installed/$PKG/receipt
14 PACKAGE_INFOS="
15 <window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
16 <vbox>
18 <tree>
19 <width>460</width><height>160</height>
20 <label>Package|$PKG</label>
21 <item icon=\"tazpkg\">Version: | $VERSION</item>
22 <item icon=\"tazpkg\">Category: | $CATEGORY</item>
23 <item icon=\"tazpkg\">Depends: | $DEPENDS</item>"
24 [ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
25 <item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
26 PACKAGE_INFOS="$PACKAGE_INFOS
27 <item icon=\"system-users\">Maintainer: | $MAINTAINER</item>
28 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
29 </tree>
31 <hbox>
32 <button>
33 <label>Remove</label>
34 <input file icon=\"edit-delete\"></input>
35 <action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
36 tazpkg remove $PACKAGE; sleep 2\"</action>
37 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
38 </button>
39 <button>
40 <label>Repack</label>
41 <input file icon=\"edit-redo\"></input>
42 <action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
43 cd /var/cache/tazpkg; \
44 tazpkg repack $PACKAGE; sleep 2\"</action>
45 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
46 </button>
47 <button>
48 <input file icon=\"gtk-close\"></input>
49 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
50 </button>
51 </hbox>
53 </vbox>
54 </window>
55 "
56 export PACKAGE_INFOS
57 else
58 RES=`grep "^$PKG" /var/lib/tazpkg/packages.desc | head -n 1`
59 PACKAGE=`echo "$RES" | cut -d "|" -f 1`
60 VERSION=`echo "$RES" | cut -d "|" -f 2`
61 CATEGORY=`echo "$RES" | cut -d "|" -f 4`
62 WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
63 export PACKAGE_INFOS="
64 <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
65 <vbox>
67 <tree>
68 <width>460</width><height>140</height>
69 <label>Package|$PKG</label>
70 <item icon=\"tazpkg\">Name: | $PACKAGE</item>
71 <item icon=\"tazpkg\">Version: | $VERSION</item>
72 <item icon=\"tazpkg\">category: | $CATEGORY</item>
73 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
74 </tree>
76 <hbox>
77 <button>
78 <label>Get-install</label>
79 <input file icon=\"go-next\"></input>
80 <action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
81 tazpkg get-install $PACKAGE; sleep 2\"</action>
82 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
83 </button>
84 <button>
85 <label>Get</label>
86 <input file icon=\"go-next\"></input>
87 <action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
88 cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
89 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
90 </button>
91 <button>
92 <input file icon=\"gtk-close\"></input>
93 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
94 </button>
95 </hbox>
97 </vbox>
98 </window>
99 "
100 fi
102 gtkdialog --center --program=PACKAGE_INFOS
104 exit 0