tazpkg view tazpkgbox @ rev 183

Add logging
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Oct 26 10:35:32 2008 +0000 (2008-10-26)
parents dffb78e149ef
children 7a68f9b5e1c2
line source
1 #!/bin/sh
2 #
3 # GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Functions
4 # path: /usr/lib/slitaz/tazpkgbox. Notes: Notebook tab are vbox, tab are
5 # used to indent.
6 #
7 # (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
8 #
9 VERSION=2.3
11 # Tazpkgbox is only for root.
12 if test $(id -u) != 0 ; then
13 exec subox tazpkgbox
14 exit 0
15 fi
17 # We need at least a mirror URL.
18 if [ ! -f /var/lib/tazpkg/mirror ]; then
19 tazpkg >/dev/null
20 fi
22 # Tmp dir and files used to get pkgs infos on the fly. Clean also
23 # list and search files to load less data and have a faster start.
24 mkdir -p /tmp/tazpkgbox
25 echo "all" > /tmp/tazpkgbox/installed-category
26 echo "all" > /tmp/tazpkgbox/installable-category
27 echo "all" > /tmp/tazpkgbox/mirrored-category
28 echo "" > /tmp/tazpkgbox/search-installed
29 echo "" > /tmp/tazpkgbox/search-mirrored
31 # English/French help dialod.
32 export HELP='
33 <window title="Tazpkgbox Help" icon-name="help">
34 <vbox>
35 <text use-markup="true" width-chars="54">
36 <label>"
37 <b>Tazpkgbox - Packages Manager Help</b>"
38 </label>
39 </text>
41 <frame English>
42 <text wrap="false">
43 <label>"
44 Tazpkgbox is a simple and easy to use interface to the SliTaz
45 package manager - aka Tazpkg. You can install, remove, repack or
46 get packages by double-clicking on the package item. A Search engine
47 lets you find and install new applications in a few mouse clicks.
49 Downloaded and repacked packages are stored in: /var/cache/tazpkg"
50 </label>
51 </text>
52 </frame>
54 <frame Français>
55 <text wrap="false">
56 <label>"
57 Tazpkgbox est une interface graphique au gestionnaire de paquet
58 de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez
59 installer, télécharger ou supprimer des paquet en double-cliquant
60 sur sa ligne. Les paquets téléchargés ou recréés sont stocké
61 dans: /var/cache/tazpkg"
62 </label>
63 </text>
64 </frame>
66 <hbox>
67 <button ok>
68 <action type="closewindow">HELP</action>
69 </button>
70 </hbox>
71 </vbox>
72 </window>
73 '
75 export LIST_CONFIG_FILES='
76 <window title="configuration files" icon-name="system-file-manager">
77 <vbox>
78 <tree exported_column="5">
79 <width>560</width><height>160</height>
80 <variable>CONF_FILE</variable>
81 <label>Access | User | Group | Size | Update Date | Name</label>
82 <input>tazpkg list-config --box</input>
83 <action>leafpad $CONF_FILE</action>
84 </tree>
85 <hbox>
86 <text wrap="false">
87 <label>
88 "Only files with Update Date have been modified after package installation"
89 </label>
90 </text>
91 <button>
92 <input file icon="gtk-close"></input>
93 <action type="closewindow">INSTALLED_PACKAGE_ACTIONS</action>
94 </button>
95 </hbox>
96 </vbox>
97 </window>
98 '
100 # Main dialog
101 export TAZPKG_DIALOG='
102 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
103 <vbox>
105 <hbox>
106 <text use-markup="true">
107 <label>"<b>Packages Manager</b>"</label>
108 </text>
109 <pixmap>
110 <input file>/usr/share/pixmaps/tazpkg.png</input>
111 </pixmap>
112 </hbox>
114 <notebook labels="Installed|Installable|Mirrored|Blocked|Search|Configuration">
116 <vbox>
117 <tree>
118 <width>620</width><height>240</height>
119 <variable>PKG</variable>
120 <label>Package name|Version|Description</label>
121 <input>/usr/lib/slitaz/tazpkgbox/list installed</input>
122 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
123 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
124 <action>refresh:PKG</action>
125 <action>refresh:PKG_STATS</action>
126 <action>refresh:CACHE_STATS</action>
127 </tree>
128 <hbox>
129 <text>
130 <label>"Category:"</label>
131 </text>
132 <combobox>
133 <variable>INSTALLED_CAT</variable>
134 <item>all</item>
135 <item>base-system</item>
136 <item>x-window</item>
137 <item>utilities</item>
138 <item>network</item>
139 <item>graphics</item>
140 <item>multimedia</item>
141 <item>office</item>
142 <item>development</item>
143 <item>system-tools</item>
144 <item>security</item>
145 <item>games</item>
146 <item>misc</item>
147 <item>meta</item>
148 <item>non-free</item>
149 </combobox>
150 <button>
151 <label>List</label>
152 <input file icon="reload"></input>
153 <action>echo "$INSTALLED_CAT" > /tmp/tazpkgbox/installed-category</action>
154 <action>refresh:PKG</action>
155 </button>
156 <button>
157 <label>Upgrade all</label>
158 <input file icon="system-software-update"></input>
159 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
160 <action>refresh:PKG</action>
161 <action>refresh:PKG_STATS</action>
162 <action>refresh:CACHE_STATS</action>
163 </button>
164 </hbox>
165 </vbox>
167 <vbox>
168 <tree>
169 <width>620</width><height>240</height>
170 <variable>GETIT</variable>
171 <label>Package name|Version|Description</label>
172 <input>/usr/lib/slitaz/tazpkgbox/list installable</input>
173 <action>echo "$GETIT" > /tmp/tazpkgbox/pkg</action>
174 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
175 <action>refresh:PKG</action>
176 <action>refresh:GETIT</action>
177 <action>refresh:PKG_STATS</action>
178 <action>refresh:CACHE_STATS</action>
179 </tree>
180 <hbox>
181 <text>
182 <label>"Category:"</label>
183 </text>
184 <combobox>
185 <variable>INSTALLABLE_CAT</variable>
186 <item>all</item>
187 <item>base-system</item>
188 <item>x-window</item>
189 <item>utilities</item>
190 <item>network</item>
191 <item>graphics</item>
192 <item>multimedia</item>
193 <item>office</item>
194 <item>development</item>
195 <item>system-tools</item>
196 <item>security</item>
197 <item>games</item>
198 <item>misc</item>
199 <item>meta</item>
200 <item>non-free</item>
201 </combobox>
202 <button>
203 <label>List</label>
204 <input file icon="reload"></input>
205 <action>echo "$INSTALLABLE_CAT" > /tmp/tazpkgbox/installable-category</action>
206 <action>refresh:GETIT</action>
207 </button>
208 <button>
209 <label>Recharge list</label>
210 <input file icon="system-software-update"></input>
211 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
212 <action>refresh:GETIT</action>
213 <action>refresh:PKG_STATS</action>
214 </button>
215 </hbox>
216 </vbox>
218 <vbox>
219 <tree>
220 <width>620</width><height>240</height>
221 <variable>GET</variable>
222 <label>Package name|Version|Description</label>
223 <input>/usr/lib/slitaz/tazpkgbox/list mirrored</input>
224 <action>echo "$GET" > /tmp/tazpkgbox/pkg</action>
225 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
226 <action>refresh:PKG</action>
227 <action>refresh:PKG_STATS</action>
228 <action>refresh:CACHE_STATS</action>
229 </tree>
230 <hbox>
231 <text>
232 <label>"Category:"</label>
233 </text>
234 <combobox>
235 <variable>MIRRORED_CAT</variable>
236 <item>all</item>
237 <item>base-system</item>
238 <item>x-window</item>
239 <item>utilities</item>
240 <item>network</item>
241 <item>graphics</item>
242 <item>multimedia</item>
243 <item>office</item>
244 <item>development</item>
245 <item>system-tools</item>
246 <item>security</item>
247 <item>games</item>
248 <item>misc</item>
249 <item>meta</item>
250 <item>non-free</item>
251 </combobox>
252 <button>
253 <label>List</label>
254 <input file icon="reload"></input>
255 <action>echo "$MIRRORED_CAT" > /tmp/tazpkgbox/mirrored-category</action>
256 <action>refresh:GET</action>
257 </button>
258 <button>
259 <label>Recharge list</label>
260 <input file icon="system-software-update"></input>
261 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
262 <action>refresh:GET</action>
263 <action>refresh:PKG_STATS</action>
264 </button>
265 </hbox>
266 </vbox>
268 <vbox>
269 <tree>
270 <width>620</width><height>240</height>
271 <variable>BLOCKED</variable>
272 <label>Package name|Version|Available|Description</label>
273 <input>/usr/lib/slitaz/tazpkgbox/list blocked</input>
274 <action>echo "$BLOCKED" > /tmp/tazpkgbox/pkg</action>
275 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
276 <action>refresh:BLOCKED</action>
277 <action>refresh:PKG_STATS</action>
278 </tree>
279 <hbox>
280 <button>
281 <label>Refresh</label>
282 <input file icon="reload"></input>
283 <action>refresh:BLOCKED</action>
284 <action>refresh:PKG_STATS</action>
285 </button>
286 </hbox>
287 </vbox>
289 <vbox>
290 <tree icon="tazpkg">
291 <width>620</width><height>120</height>
292 <variable>RESULT_INSTALLED</variable>
293 <label>Installed packages|Version|Description / File</label>
294 <input>cat /tmp/tazpkgbox/search-installed</input>
295 <action>echo "$RESULT_INSTALLED" > /tmp/tazpkgbox/pkg</action>
296 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
297 <action>/usr/lib/slitaz/tazpkgbox/search</action>
298 <action>refresh:RESULT_INSTALLED</action>
299 <action>refresh:PKG</action>
300 <action>refresh:PKG_STATS</action>
301 <action>refresh:CACHE_STATS</action>
302 </tree>
303 <tree icon="tazpkg">
304 <width>620</width><height>120</height>
305 <variable>RESULT_MIRROR</variable>
306 <label>Mirrored packages|Version|Description / File</label>
307 <input>cat /tmp/tazpkgbox/search-mirrored</input>
308 <action>echo "$RESULT_MIRROR" > /tmp/tazpkgbox/pkg</action>
309 <action>/usr/lib/slitaz/tazpkgbox/package_infos</action>
310 <action>/usr/lib/slitaz/tazpkgbox/search</action>
311 <action>refresh:RESULT_INSTALLED</action>
312 <action>refresh:PKG</action>
313 <action>refresh:PKG_STATS</action>
314 <action>refresh:CACHE_STATS</action>
315 </tree>
316 <hbox>
317 <entry>
318 <variable>SEARCH</variable>
319 </entry>
320 <button>
321 <label>Search Packages</label>
322 <input file icon="system-search"></input>
323 <action>/usr/lib/slitaz/tazpkgbox/search</action>
324 <action>refresh:RESULT_INSTALLED</action>
325 <action>refresh:RESULT_MIRROR</action>
326 </button>
327 <button>
328 <label>Search Files</label>
329 <input file icon="system-search"></input>
330 <action>/usr/lib/slitaz/tazpkgbox/search --files</action>
331 <action>refresh:RESULT_INSTALLED</action>
332 <action>refresh:RESULT_MIRROR</action>
333 </button>
334 </hbox>
335 </vbox>
337 <vbox>
338 <frame Cache directory>
339 <text use-markup="true" width-chars="60" wrap="false">
340 <label>
341 "The cache directory is used to store downloaded or repacked packages."
342 </label>
343 </text>
344 <hbox>
345 <entry editable="false">
346 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
347 <variable>CACHE_STATS</variable>
348 </entry>
349 <button>
350 <label>Clean cache</label>
351 <input file icon="go-next"></input>
352 <action>rm -rf /var/cache/tazpkg/*</action>
353 <action>refresh:CACHE_STATS</action>
354 </button>
355 </hbox>
356 </frame>
357 <frame Mirror URL>
358 <hbox>
359 <entry>
360 <input>head -n 1 /var/lib/tazpkg/mirror</input>
361 <variable>MIRROR</variable>
362 </entry>
363 <button>
364 <label>Setup</label>
365 <input file icon="go-next"></input>
366 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
367 <action>clear:MIRROR</action>
368 <action>refresh:MIRROR</action>
369 </button>
370 <button>
371 <label>Add</label>
372 <input file icon="gtk-add"></input>
373 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
374 <action>clear:MIRROR</action>
375 <action>refresh:MIRROR</action>
376 </button>
377 </hbox>
378 </frame>
379 <frame Files path>
380 <hbox>
381 <text use-markup="true" width-chars="60">
382 <label>
383 "Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>"
384 </label>
385 </text>
386 </hbox>
387 </frame>
388 <hbox>
389 <frame Journal>
390 <hbox>
391 <button>
392 <label>Show journal</label>
393 <input file icon="find"></input>
394 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Tazpkg journal (q to quit)" -geometry 80x25+120+120 -e "ls -l /var/log/tazpkg.log | cat - /var/log/tazpkg.log | less"</action>
395 </button>
396 </hbox>
397 </frame>
398 <frame Configuration files>
399 <hbox>
400 <button>
401 <label>Repack config</label>
402 <input file icon="edit-redo"></input>
403 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Repack configs" -geometry 80x25+120+120 -e "tazpkg repack-config ; sleep 5" 2> /dev/null</action>
404 </button>
405 <button>
406 <label>Config Files</label>
407 <input file icon="tazpkg"></input>
408 <action type="launch">LIST_CONFIG_FILES</action>
409 </button>
410 </hbox>
411 </frame>
412 <frame Packages check>
413 <hbox>
414 <button>
415 <label>Quick check</label>
416 <input file icon="go-next"></input>
417 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check | less " 2> /dev/null</action>
418 </button>
419 <button>
420 <label>Full check</label>
421 <input file icon="go-next"></input>
422 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "Check packages (q to quit)" -geometry 80x25+120+120 -e "tazpkg check --full | less " 2> /dev/null</action>
423 </button>
424 </hbox>
425 </frame>
426 </hbox>
427 </vbox>
429 </notebook>
431 <hbox>
432 <text wrap="false">
433 <input>installed=`ls /var/lib/tazpkg/installed | wc -l`; mirrored=`cat /var/lib/tazpkg/packages.list | wc -l`; blocked=`cat /var/lib/tazpkg/blocked-packages.list | wc -l`; echo "Packages: $installed installed, $blocked blocked, $(($mirrored - $installed)) installable, $mirrored mirrored, `cat /var/lib/tazpkg/upgradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
434 <variable>PKG_STATS</variable>
435 </text>
436 </hbox>
438 <hbox>
439 <button>
440 <label>Wok</label>
441 <input file icon="gtk-open"></input>
442 <action>firefox http://hg.slitaz.org/wok/file/</action>
443 </button>
444 <button help>
445 <label>Help</label>
446 <action type="launch">HELP</action>
447 </button>
448 <button>
449 <label>Exit</label>
450 <input file icon="exit"></input>
451 <action type="exit">Exit</action>
452 </button>
453 </hbox>
455 </vbox>
457 </window>
458 '
460 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
462 exit 0