tazpkg view lib/tazpkgbox/package_infos @ rev 131

tazpkgbox: fix DEPENDS field, set WEB_SITE clickable
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 18 14:52:05 2008 +0000 (2008-07-18)
parents 3ad89c4852fb
children c898090ba1bd
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 if [ "$1" = "list_files" ]; then
11 tazpkg list-files $2 | awk '
12 BEGIN { ls=0 } {
13 if (/^===/) ls=1-ls;
14 else if (ls) system("stat -c \"%A|%U|%G|%s|%n\" " $0);
15 }'
16 exit 0
17 fi
19 if [ "$1" = "list_files_mirror" ]; then
20 unlzma -c /var/lib/tazpkg/files.list.lzma | grep -- "^$2:" | \
21 awk '{ print substr($0,index($0,":")+2) }'
22 exit 0
23 fi
25 export LIST_FILES="
26 <window title=\"$PKG files\" icon-name=\"system-file-manager\">
27 <vbox>
28 <tree>
29 <width>600</width><height>160</height>
30 <label>Access | User | Group | Size | Name</label>
31 <input> $0 list_files $PKG </input>
32 </tree>
33 <hbox>
34 <button>
35 <input file icon=\"gtk-close\"></input>
36 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
37 </button>
38 </hbox>
39 </vbox>
40 </window>
41 "
43 export LIST_FILES_MIRROR="
44 <window title=\"$PKG files\" icon-name=\"system-file-manager\">
45 <vbox>
46 <tree>
47 <width>300</width><height>160</height>
48 <label>File Name</label>
49 <input> $0 list_files_mirror $PKG </input>
50 </tree>
51 <hbox>
52 <button>
53 <input file icon=\"gtk-close\"></input>
54 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
55 </button>
56 </hbox>
57 </vbox>
58 </window>
59 "
61 # Installed or not installed, that the question.
62 if [ -d /var/lib/tazpkg/installed/$PKG ]; then
63 PACKED_SIZE=""
64 DEPENDS=""
65 . /var/lib/tazpkg/installed/$PKG/receipt
66 PACKAGE_INFOS="
67 <window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
68 <vbox>
70 <tree>
71 <width>460</width><height>160</height>
72 <label>Package|$PKG</label>
73 <variable>FIELD</variable>
74 <item icon=\"tazpkg\">Version: | $VERSION</item>
75 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
76 [ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
77 <item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
78 [ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
79 <item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
80 PACKAGE_INFOS="$PACKAGE_INFOS
81 <item icon=\"system-users\">Maintainer: | $MAINTAINER</item>
82 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
83 <action>case \$FIELD in Web*) firefox $WEB_SITE &;; esac</action>
84 </tree>
86 <hbox>"
87 [ $CATEGORY = non-free -a ! -d /var/lib/tazpkg/installed/${PKG#get-} ] && PACKAGE_INFOS="$PACKAGE_INFOS
88 <button>
89 <label>Install</label>
90 <input file icon=\"go-next\"></input>
91 <action>xterm -T \"Install ${PKG#get-}\" $XTERM_OPTS -e \"\
92 $PKG; sleep 5\"</action>
93 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
94 </button>"
95 grep -q post_install /var/lib/tazpkg/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
96 <button>
97 <label>Reconfigure</label>
98 <input file icon=\"reload\"></input>
99 <action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
100 tazpkg reconfigure $PACKAGE; sleep 2\"</action>
101 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
102 </button>"
103 if grep -q ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
104 PACKAGE_INFOS="$PACKAGE_INFOS
105 <button>
106 <label>Unblock</label>
107 <input file icon=\"up\"></input>
108 <action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
109 tazpkg unblock $PACKAGE; sleep 2\"</action>
110 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
111 </button>"
112 else
113 PACKAGE_INFOS="$PACKAGE_INFOS
114 <button>
115 <label>Block</label>
116 <input file icon=\"down\"></input>
117 <action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
118 tazpkg block $PACKAGE; sleep 2\"</action>
119 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
120 </button>"
121 fi
122 PACKAGE_INFOS="$PACKAGE_INFOS
123 <button>
124 <label>Remove</label>
125 <input file icon=\"edit-delete\"></input>
126 <action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
127 tazpkg remove $PACKAGE; sleep 2\"</action>
128 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
129 </button>
130 <button>
131 <label>Repack</label>
132 <input file icon=\"edit-redo\"></input>
133 <action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
134 cd /var/cache/tazpkg; \
135 tazpkg repack $PACKAGE; sleep 2\"</action>
136 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
137 </button>
138 <button>
139 <label>Files</label>
140 <input file icon=\"tazpkg\"></input>
141 <action type=\"launch\">LIST_FILES</action>
142 </button>
143 <button>
144 <input file icon=\"gtk-close\"></input>
145 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
146 </button>
147 </hbox>
149 </vbox>
150 </window>
151 "
152 export PACKAGE_INFOS
153 else
154 RES=`grep "^$PKG" /var/lib/tazpkg/packages.desc | head -n 1`
155 PACKAGE=`echo "$RES" | cut -d "|" -f 1`
156 VERSION=`echo "$RES" | cut -d "|" -f 2`
157 CATEGORY=`echo "$RES" | cut -d "|" -f 4`
158 WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
159 SIZES=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1`
160 PACKAGE_INFOS="
161 <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
162 <vbox>
164 <tree>
165 <width>460</width><height>140</height>
166 <label>Package|$PKG</label>
167 <item icon=\"tazpkg\">Name: | $PACKAGE</item>
168 <item icon=\"tazpkg\">Version: | $VERSION</item>
169 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
170 [ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
171 <item icon=\"tazpkg\">Size: | $SIZES</item>"
172 PACKAGE_INFOS="$PACKAGE_INFOS
173 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
174 </tree>
176 <hbox>"
177 [ $CATEGORY = non-free ] && PACKAGE_INFOS="$PACKAGE_INFOS
178 <checkbox>
179 <label>Auto exec</label>
180 <variable>AUTO_EXEC</variable>
181 <default>true</default>
182 </checkbox>"
183 PACKAGE_INFOS="$PACKAGE_INFOS
184 <checkbox>
185 <label>Auto install depends</label>
186 <variable>AUTO_DEPENDS</variable>
187 <default>true</default>
188 </checkbox>
189 <button>
190 <label>Get-install</label>
191 <input file icon=\"go-next\"></input>
192 <action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
193 if [ \$AUTO_DEPENDS != true ]; then tazpkg get-install $PACKAGE;\
194 else yes y | tazpkg get-install $PACKAGE; fi; \
195 [ \${AUTO_EXEC}$CATEGORY = truenon-free ] && $PACKAGE; \
196 sleep 2\"</action>
197 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
198 </button>
199 <button>
200 <label>Get</label>
201 <input file icon=\"go-next\"></input>
202 <action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
203 cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
204 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
205 </button>
206 <button>
207 <label>Files</label>
208 <input file icon=\"tazpkg\"></input>
209 <action type=\"launch\">LIST_FILES_MIRROR</action>
210 </button>
211 <button>
212 <input file icon=\"gtk-close\"></input>
213 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
214 </button>
215 </hbox>
217 </vbox>
218 </window>
219 "
220 export PACKAGE_INFOS
221 fi
223 gtkdialog --center --program=PACKAGE_INFOS
225 exit 0