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