tazpkg view tazpkgbox @ rev 279

Prepa for release
author Christophe Lincoln <pankso@slitaz.org>
date Wed Aug 05 23:20:25 2009 +0200 (2009-08-05)
parents 2be96b3e57dd
children 518d23c7f3e7
line source
1 #!/bin/sh
2 #
3 # GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Notes:
4 # Notebook tab are vbox, tabs are used to indent and functions are
5 # split and found in $LIB.
6 #
7 # (C) GNU gpl v3 - SliTaz GNU/Linux 2009.
8 #
9 VERSION=3.0
11 # Functions path.
12 export LIB=/usr/lib/slitaz/tazpkgbox
14 # Tazpkgbox is only for root.
15 if test $(id -u) != 0 ; then
16 exec subox tazpkgbox
17 exit 0
18 fi
20 # We need at least a mirror URL.
21 if [ ! -f /var/lib/tazpkg/mirror ]; then
22 tazpkg >/dev/null
23 fi
25 RELEASE=$(cat /etc/slitaz-release)
26 case "$1" in
27 dliso)
28 echo "Downloading packages-$RELEASE.iso into $2..."
29 cd $2
30 for i in $(cat /var/lib/tazpkg/mirror) ; do
31 wget ${i%packages*}/iso/$RELEASE/packages-$RELEASE.iso && break
32 done
33 exit 0;;
34 instiso)
35 PKGSIGN="LABEL=\"packages-$RELEASE\" TYPE=\"iso9660\""
36 PKGDEV=$(blkid $2 | grep "$PKGSIGN" | cut -d: -f1)
37 [ -z "$PKGDEV$2" -a -L /dev/cdrom ] && PKGDEV=$(blkid /dev/cdrom | grep "$PKGSIGN" | cut -d: -f1)
38 if [ -n "$PKGDEV" ]; then
39 mkdir /packages 2> /dev/null
40 mount -t iso9660 -o ro $PKGDEV /packages
41 /packages/install.sh
42 fi
43 exit 0;;
44 esac
45 # Tmp dir and files used to get pkgs info on the fly. Clean also
46 # lists and searches for files to load less data and have a faster start.
47 mkdir -p /tmp/tazpkgbox
48 echo "all" > /tmp/tazpkgbox/status
49 echo "all" > /tmp/tazpkgbox/category
50 echo "all" > /tmp/tazpkgbox/undigest-category
51 echo "" > /tmp/tazpkgbox/search
53 # English/French help dialog.
54 export HELP='
55 <window title="Tazpkgbox Help" icon-name="help">
56 <vbox>
57 <text use-markup="true" width-chars="54">
58 <label>"
59 <b>Tazpkgbox - Packages Manager Help</b>"
60 </label>
61 </text>
63 <frame English>
64 <text wrap="false">
65 <label>"
66 Tazpkgbox is a simple and easy to use interface to the SliTaz
67 package manager - aka Tazpkg. You can install, remove, repack or
68 get packages by double-clicking on the package item. A Search engine
69 lets you find and install new applications in a few mouse clicks."
70 </label>
71 </text>
72 </frame>
74 <frame Français>
75 <text wrap="false">
76 <label>"
77 Tazpkgbox est une interface graphique au gestionnaire de paquet
78 de Slitaz aka Tazpkg. Simple et facile à utiliser, vous pouvez
79 installer, télécharger ou supprimer des paquets en double-cliquant
80 sur sa ligne. La fonction de recherche permet de facilement trouver
81 et installer des logiciels ou fichiers."
82 </label>
83 </text>
84 </frame>
86 <hbox>
87 <button ok>
88 <action type="closewindow">HELP</action>
89 </button>
90 </hbox>
91 </vbox>
92 </window>
93 '
95 FILES="$2"
96 [ "$1" = "list_config" ] || FILES=""
98 export SETUP_DVD="
99 <window title=\"Packages archive\" icon-name=\"media-cdrom\">
100 <vbox>
101 <text use-markup=\"true\" width-chars=\"54\">
102 <label>\"
103 <b>Tazpkgbox - Packages Archive Manager</b>\"
104 </label>
105 </text>
106 <frame English>
107 <text wrap=\"false\">
108 <label>\"
109 An ISO image with all $(cat /etc/slitaz-release) packages is available on Slitaz mirrors.
110 You can burn it on a DVD or install it on an USB key and each
111 package becomes installable without Internet connexion.\"
112 </label>
113 </text>
114 </frame>
116 <frame Français>
117 <text wrap=\"false\">
118 <label>\"
119 Une image ISO installable sur clé USB ou gravable sur DVD est
120 disponible sur les mirroirs Slitaz. Elle contient tous les paquets
121 de la version $(cat /etc/slitaz-release) pour pouvoir installer des paquets sans
122 connexion Internet.\"
123 </label>
124 </text>
125 </frame>
126 <frame>
127 <hbox>
128 <text use-markup=\"true\">
129 <label>\"<b>ISO image : </b>\"</label>
130 </text>
131 <entry>
132 <variable>PKGISO</variable>
133 </entry>
134 <button>
135 <input file stock=\"gtk-open\"></input>
136 <action type=\"fileselect\">PKGISO</action>
137 </button>
138 <button>
139 <label>Install ISO</label>
140 <input file icon=\"go-jump\"></input>
141 <action>xterm -T \"Install ISO\" -geometry 80x16+120+120 -e \"tazpkgbox instiso \$PKGISO; sleep 2\" 2>/dev/null</action>
142 <action>refresh:PKG</action>
143 <action>refresh:PKG_STATS</action>
144 <action>refresh:CACHE_STATS</action>
145 </button>
146 </hbox>
147 </frame>
148 <hbox>
149 <button>
150 <label>Download ISO</label>
151 <input file icon=\"system-software-update\"></input>
152 <action>xterm -T \"Download ISO\" -geometry 80x16+120+120 -e \"tazpkgbox dliso /tmp; sleep 2\" 2>/dev/null</action>
153 </button>
154 <button>
155 <input file icon=\"media-cdrom\"></input>
156 <label>Burn DVD</label>
157 <action>burnbox</action>
158 </button>
159 <button>
160 <label>Install DVD/USB key</label>
161 <input file icon=\"go-jump\"></input>
162 <action>xterm -T \"Install DVD/USB key\" -geometry 80x16+120+120 -e \"tazpkgbox instiso; sleep 2\" 2>/dev/null</action>
163 <action>refresh:PKG</action>
164 <action>refresh:PKG_STATS</action>
165 <action>refresh:CACHE_STATS</action>
166 </button>
167 <button>
168 <input file icon=\"gtk-close\"></input>
169 <action type=\"closewindow\">SETUP_DVD</action>
170 </button>
171 </hbox>
172 </vbox>
173 </window>
174 "
176 export LIST_CONFIG_FILES="
177 <window title=\"configuration files\" icon-name=\"system-file-manager\">
178 <vbox>
179 <tree exported_column=\"5\">
180 <width>560</width><height>160</height>
181 <variable>CONF_FILE</variable>
182 <label>Access | User | Group | Size | Update Date | Name</label>
183 <input>tazpkg list-config --box $FILES</input>
184 <action>leafpad \$CONF_FILE</action>
185 </tree>
186 <hbox>
187 <text wrap=\"false\">
188 <label>
189 \"Only files with Update Date have been modified after package installation\"
190 </label>
191 </text>
192 <button>
193 <input file icon=\"gtk-close\"></input>
194 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
195 </button>
196 </hbox>
197 </vbox>
198 </window>
199 "
200 if [ "$1" = "list_config" ]; then
201 gtkdialog --center --program=LIST_CONFIG_FILES >/dev/null
202 exit 0
203 fi
205 export SETUP_UNDIGEST='
206 <window title="undigest mirrors" icon-name="tazpkg">
207 <vbox>
208 <tree>
209 <width>560</width><height>160</height>
210 <variable>UNDIGEST_LIST</variable>
211 <label>Name | URL</label>
212 <input>tazpkg list-undigest --box</input>
213 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_LIST; sleep 2"</action>
214 </tree>
215 <hbox>
216 <text>
217 <label>URL:</label>
218 </text>
219 <entry>
220 <variable>UNDIGEST_URL</variable>
221 </entry>
222 </hbox>
223 <hbox>
224 <text>
225 <label>Name:</label>
226 </text>
227 <entry>
228 <variable>UNDIGEST_NAME</variable>
229 </entry>
230 <button>
231 <label>Add</label>
232 <input file icon="gtk-add"></input>
233 <action>tazpkg add-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
234 <action>refresh:UNDIGEST_LIST</action>
235 </button>
236 <button>
237 <label>Remove</label>
238 <input file icon="gtk-remove"></input>
239 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_NAME; sleep 2"</action>
240 <action>refresh:UNDIGEST_LIST</action>
241 </button>
242 <button>
243 <label>Update</label>
244 <input file icon="reload"></input>
245 <action>tazpkg setup-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
246 <action>refresh:UNDIGEST_LIST</action>
247 </button>
248 <button>
249 <input file icon="gtk-close"></input>
250 <action type="closewindow">SETUP_UNDIGEST</action>
251 </button>
252 </hbox>
253 </vbox>
254 </window>
255 '
257 # Scan notification
258 desktopbox notify "Scanning packages database" 6 &
260 # Main dialog
261 export TAZPKG_DIALOG='
262 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
263 <vbox>
265 <hbox>
266 <text use-markup="true">
267 <label>"<b>Packages Manager</b>"</label>
268 </text>
269 <pixmap>
270 <input file>/usr/share/pixmaps/tazpkg.png</input>
271 </pixmap>
272 </hbox>
274 <notebook labels="Packages|Search|Undigest|Configuration">
276 <vbox>
277 <tree>
278 <width>620</width><height>240</height>
279 <variable>PKG</variable>
280 <label>Name|Version|Description</label>
281 <input icon_column="0">$LIB/list all</input>
282 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
283 <action>$LIB/package_infos</action>
284 <action>refresh:PKG</action>
285 <action>refresh:PKG_STATS</action>
286 <action>refresh:CACHE_STATS</action>
287 </tree>
288 <hbox>
289 <text>
290 <label>"Status:"</label>
291 </text>
292 <combobox>
293 <variable>STATUS</variable>
294 <item>all</item>
295 <item>installed</item>
296 <item>installable</item>
297 <item>blocked</item>
298 </combobox>
299 <text>
300 <label>"Category:"</label>
301 </text>
302 <combobox>
303 <variable>CAT</variable>
304 <item>all</item>
305 <item>base-system</item>
306 <item>x-window</item>
307 <item>utilities</item>
308 <item>network</item>
309 <item>graphics</item>
310 <item>multimedia</item>
311 <item>office</item>
312 <item>development</item>
313 <item>system-tools</item>
314 <item>security</item>
315 <item>games</item>
316 <item>misc</item>
317 <item>meta</item>
318 <item>non-free</item>
319 </combobox>
320 <button>
321 <label>List</label>
322 <input file icon="reload"></input>
323 <action>echo "$CAT" > /tmp/tazpkgbox/category</action>
324 <action>echo "$STATUS" > /tmp/tazpkgbox/status</action>
325 <action>refresh:PKG</action>
326 </button>
327 </hbox>
328 </vbox>
330 <vbox>
331 <tree>
332 <width>620</width><height>120</height>
333 <variable>RESULT</variable>
334 <label>Packages Name|Version|Description / File</label>
335 <input icon_column="0">cat /tmp/tazpkgbox/search</input>
336 <action>echo "$RESULT" > /tmp/tazpkgbox/pkg</action>
337 <action>$LIB/package_infos</action>
338 <action>$LIB/search packages</action>
339 <action>refresh:RESULT</action>
340 <action>refresh:PKG</action>
341 <action>refresh:PKG_STATS</action>
342 <action>refresh:CACHE_STATS</action>
343 </tree>
344 <hbox>
345 <entry>
346 <variable>SEARCH</variable>
347 </entry>
348 <button>
349 <label>Packages</label>
350 <input file icon="system-search"></input>
351 <action>$LIB/search packages</action>
352 <action>refresh:RESULT</action>
353 </button>
354 <button>
355 <label>Files</label>
356 <input file icon="system-search"></input>
357 <action>$LIB/search files</action>
358 <action>refresh:RESULT</action>
359 </button>
360 </hbox>
361 </vbox>
363 <vbox>
364 <tree>
365 <width>620</width><height>240</height>
366 <variable>DEV</variable>
367 <label>Name|Version|Description</label>
368 <input icon_column="0">$LIB/list undigest</input>
369 <action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
370 <action>$LIB/package_infos</action>
371 <action>refresh:PKG</action>
372 <action>refresh:PKG_STATS</action>
373 <action>refresh:CACHE_STATS</action>
374 </tree>
375 <hbox>
376 <button>
377 <label>Setup undigest mirrors</label>
378 <input file icon="go-next"></input>
379 <action type="launch">SETUP_UNDIGEST</action>
380 </button>
381 </hbox>
382 <hbox>
383 <text>
384 <label>"Undigest:"</label>
385 </text>
386 <combobox>
387 <variable>UNDIGEST_ENTRY</variable>
388 '
389 for i in all $(ls /var/lib/tazpkg/undigest 2> /dev/null); do
390 TAZPKG_DIALOG="$TAZPKG_DIALOG <item>$i</item> "
391 done
392 tmp=' </combobox>
393 <text>
394 <label>"Category:"</label>
395 </text>
396 <combobox>
397 <variable>UNDIGEST_CAT</variable>
398 <item>all</item>
399 <item>base-system</item>
400 <item>x-window</item>
401 <item>utilities</item>
402 <item>network</item>
403 <item>graphics</item>
404 <item>multimedia</item>
405 <item>office</item>
406 <item>development</item>
407 <item>system-tools</item>
408 <item>security</item>
409 <item>games</item>
410 <item>misc</item>
411 <item>meta</item>
412 <item>non-free</item>
413 </combobox>
414 <button>
415 <label>List</label>
416 <input file icon="reload"></input>
417 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
418 <action>refresh:DEV</action>
419 </button>
420 </hbox>
421 </vbox>
423 <vbox>
424 <frame Files and Cache directory>
425 <text use-markup="true" width-chars="60" wrap="false">
426 <label>"
427 Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>
428 The cache directory is used to store downloaded or repacked packages.
429 "</label>
430 </text>
431 <hbox>
432 <entry editable="false">
433 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
434 <variable>CACHE_STATS</variable>
435 </entry>
436 <button>
437 <label>Clean cache</label>
438 <input file icon="go-next"></input>
439 <action>rm -rf /var/cache/tazpkg/*</action>
440 <action>refresh:CACHE_STATS</action>
441 </button>
442 </hbox>
443 </frame>
444 <frame Mirror URL>
445 <hbox>
446 <entry>
447 <input>head -n 1 /var/lib/tazpkg/mirror</input>
448 <variable>MIRROR</variable>
449 </entry>
450 <button>
451 <label>Setup</label>
452 <input file icon="go-next"></input>
453 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
454 <action>clear:MIRROR</action>
455 <action>refresh:MIRROR</action>
456 </button>
457 <button>
458 <label>Add</label>
459 <input file icon="gtk-add"></input>
460 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
461 <action>clear:MIRROR</action>
462 <action>refresh:MIRROR</action>
463 </button>
464 <button>
465 <input file icon="media-cdrom"></input>
466 <label>DVD</label>
467 <action type="launch">SETUP_DVD</action>
468 </button>
469 </hbox>
470 </frame>
471 <hbox>
472 <frame Journal>
473 <hbox>
474 <button>
475 <label>Show journal</label>
476 <input file icon="find"></input>
477 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -T "$(ls -l /var/log/tazpkg.log | while read mod links user grep remain ; do echo $remain ; done) (q to quit)" -geometry 80x25+120+120 -e "cat /var/log/tazpkg.log | less"</action>
478 </button>
479 </hbox>
480 </frame>
481 <frame Configuration files>
482 <hbox>
483 <button>
484 <label>Repack config</label>
485 <input file icon="edit-redo"></input>
486 <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>
487 </button>
488 <button>
489 <label>Config Files</label>
490 <input file icon="tazpkg"></input>
491 <action type="launch">LIST_CONFIG_FILES</action>
492 </button>
493 </hbox>
494 </frame>
495 <frame Packages check>
496 <hbox>
497 <button>
498 <label>Quick check</label>
499 <input file icon="go-next"></input>
500 <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>
501 </button>
502 <button>
503 <label>Full check</label>
504 <input file icon="go-next"></input>
505 <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>
506 </button>
507 </hbox>
508 </frame>
509 </hbox>
510 </vbox>
512 </notebook>
514 <hbox>
515 <text wrap="false" width-chars="82">
516 <input>installed=`ls /var/lib/tazpkg/installed | wc -l`; mirrored=`cat /var/lib/tazpkg/packages.list | wc -l`; undigest=`cat /var/lib/tazpkg/undigest/*/packages.list 2> /dev/null | wc -l`; blocked=`cat /var/lib/tazpkg/blocked-packages.list 2> /dev/null | wc -l`; installable=$(($mirrored + $undigest - $installed)); [ $installable -lt 0 ] && installable=0; echo -n "Packages statistics: $installed installed, $blocked blocked, $installable installable, $undigest undigest, $mirrored mirrored, `cat /var/lib/tazpkg/upgradable-packages.list 2> /dev/null | wc -l` to upgrade "</input>
517 <variable>PKG_STATS</variable>
518 </text>
519 </hbox>
521 <hbox>
522 <button>
523 <label>Recharge lists</label>
524 <input file icon="system-software-update"></input>
525 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
526 <action>refresh:DEV</action>
527 <action>refresh:PKG</action>
528 <action>refresh:PKG_STATS</action>
529 <action>refresh:CACHE_STATS</action>
530 </button>
531 <button>
532 <label>Upgrade all</label>
533 <input file icon="system-software-update"></input>
534 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
535 <action>refresh:PKG</action>
536 <action>refresh:DEV</action>
537 <action>refresh:PKG_STATS</action>
538 <action>refresh:CACHE_STATS</action>
539 </button>
540 <button>
541 <label>Wok</label>
542 <input file icon="gtk-open"></input>
543 <action>firefox http://hg.slitaz.org/wok/file/</action>
544 </button>
545 <button help>
546 <label>Help</label>
547 <action type="launch">HELP</action>
548 </button>
549 <button>
550 <label>Exit</label>
551 <input file icon="exit"></input>
552 <action type="exit">Exit</action>
553 </button>
554 </hbox>
556 </vbox>
558 </window>
559 '
560 TAZPKG_DIALOG="$TAZPKG_DIALOG$tmp"
562 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
564 exit 0