tazpkg view lib/tazpkgbox/package_infos @ rev 92

tazpkgbox: add reconfigure button
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 19 20:53:57 2008 +0000 (2008-05-19)
parents cedd75bd9d6e
children e64d6b7e4d73
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 DEPENDS=""
14 . /var/lib/tazpkg/installed/$PKG/receipt
15 PACKAGE_INFOS="
16 <window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
17 <vbox>
19 <tree>
20 <width>460</width><height>160</height>
21 <label>Package|$PKG</label>
22 <item icon=\"tazpkg\">Version: | $VERSION</item>
23 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
24 [ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
25 <item icon=\"tazpkg\">Depends: | $DEPENDS</item>"
26 [ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
27 <item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
28 PACKAGE_INFOS="$PACKAGE_INFOS
29 <item icon=\"system-users\">Maintainer: | $MAINTAINER</item>
30 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
31 </tree>
33 <hbox>"
34 grep -q post_install /var/lib/tazpkg/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
35 <button>
36 <label>Reconfigure</label>
37 <input file icon=\"reload\"></input>
38 <action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
39 tazpkg reconfigure $PACKAGE; sleep 2\"</action>
40 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
41 </button>"
42 PACKAGE_INFOS="$PACKAGE_INFOS
43 <button>
44 <label>Remove</label>
45 <input file icon=\"edit-delete\"></input>
46 <action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
47 tazpkg remove $PACKAGE; sleep 2\"</action>
48 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
49 </button>
50 <button>
51 <label>Repack</label>
52 <input file icon=\"edit-redo\"></input>
53 <action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
54 cd /var/cache/tazpkg; \
55 tazpkg repack $PACKAGE; sleep 2\"</action>
56 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
57 </button>
58 <button>
59 <input file icon=\"gtk-close\"></input>
60 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
61 </button>
62 </hbox>
64 </vbox>
65 </window>
66 "
67 export PACKAGE_INFOS
68 else
69 RES=`grep "^$PKG" /var/lib/tazpkg/packages.desc | head -n 1`
70 PACKAGE=`echo "$RES" | cut -d "|" -f 1`
71 VERSION=`echo "$RES" | cut -d "|" -f 2`
72 CATEGORY=`echo "$RES" | cut -d "|" -f 4`
73 WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
74 SIZES=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1`
75 PACKAGE_INFOS="
76 <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
77 <vbox>
79 <tree>
80 <width>460</width><height>140</height>
81 <label>Package|$PKG</label>
82 <item icon=\"tazpkg\">Name: | $PACKAGE</item>
83 <item icon=\"tazpkg\">Version: | $VERSION</item>
84 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
85 [ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
86 <item icon=\"tazpkg\">Size: | $SIZES</item>"
87 PACKAGE_INFOS="$PACKAGE_INFOS
88 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
89 </tree>
91 <hbox>
92 <button>
93 <label>Get-install</label>
94 <input file icon=\"go-next\"></input>
95 <action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
96 tazpkg get-install $PACKAGE; sleep 2\"</action>
97 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
98 </button>
99 <button>
100 <label>Get</label>
101 <input file icon=\"go-next\"></input>
102 <action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
103 cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
104 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
105 </button>
106 <button>
107 <input file icon=\"gtk-close\"></input>
108 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
109 </button>
110 </hbox>
112 </vbox>
113 </window>
114 "
115 export PACKAGE_INFOS
116 fi
118 gtkdialog --center --program=PACKAGE_INFOS
120 exit 0