tazpkg view tazpkgbox @ rev 237

tazpkgbox: edit help and tiny fix
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 25 22:37:30 2009 +0100 (2009-02-25)
parents 3b6cd157c06b
children 826589393fdf
line source
1 #!/bin/sh
2 #
3 # GTKdialog interface to SliTaz Packages Manager aka Tazpkg. Notes:
4 # Notebook tab are vbox, tab are used to indent and functions are
5 # splited ang found in $LIB.
6 #
7 # (C) GNU gpl v3 - SliTaz GNU/Linux 2009.
8 #
9 VERSION=2.6
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 # Tmp dir and files used to get pkgs infos on the fly. Clean also
26 # list and search files to load less data and have a faster start.
27 mkdir -p /tmp/tazpkgbox
28 echo "all" > /tmp/tazpkgbox/status
29 echo "all" > /tmp/tazpkgbox/category
30 echo "all" > /tmp/tazpkgbox/undigest-category
31 echo "" > /tmp/tazpkgbox/search
33 # English/French help dialod.
34 export HELP='
35 <window title="Tazpkgbox Help" icon-name="help">
36 <vbox>
37 <text use-markup="true" width-chars="54">
38 <label>"
39 <b>Tazpkgbox - Packages Manager Help</b>"
40 </label>
41 </text>
43 <frame English>
44 <text wrap="false">
45 <label>"
46 Tazpkgbox is a simple and easy to use interface to the SliTaz
47 package manager - aka Tazpkg. You can install, remove, repack or
48 get packages by double-clicking on the package item. A Search engine
49 lets you find and install new applications in a few mouse clicks."
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 paquets en double-cliquant
60 sur sa ligne. La fonction de recherche permet de facilement trouver
61 et installer des logiciels ou fichiers."
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 FILES="$2"
76 [ "$1" = "list_config" ] || FILES=""
77 export LIST_CONFIG_FILES="
78 <window title=\"configuration files\" icon-name=\"system-file-manager\">
79 <vbox>
80 <tree exported_column=\"5\">
81 <width>560</width><height>160</height>
82 <variable>CONF_FILE</variable>
83 <label>Access | User | Group | Size | Update Date | Name</label>
84 <input>tazpkg list-config --box $FILES</input>
85 <action>leafpad \$CONF_FILE</action>
86 </tree>
87 <hbox>
88 <text wrap=\"false\">
89 <label>
90 \"Only files with Update Date have been modified after package installation\"
91 </label>
92 </text>
93 <button>
94 <input file icon=\"gtk-close\"></input>
95 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
96 </button>
97 </hbox>
98 </vbox>
99 </window>
100 "
101 if [ "$1" = "list_config" ]; then
102 gtkdialog --center --program=LIST_CONFIG_FILES >/dev/null
103 exit 0
104 fi
106 export SETUP_UNDIGEST='
107 <window title="undigest mirrors" icon-name="tazpkg">
108 <vbox>
109 <tree>
110 <width>560</width><height>160</height>
111 <variable>UNDIGEST_LIST</variable>
112 <label>Name | URL</label>
113 <input>tazpkg list-undigest --box</input>
114 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_LIST; sleep 2"</action>
115 </tree>
116 <hbox>
117 <text>
118 <label>URL:</label>
119 </text>
120 <entry>
121 <variable>UNDIGEST_URL</variable>
122 </entry>
123 </hbox>
124 <hbox>
125 <text>
126 <label>Name:</label>
127 </text>
128 <entry>
129 <variable>UNDIGEST_NAME</variable>
130 </entry>
131 <button>
132 <label>Add</label>
133 <input file icon="gtk-add"></input>
134 <action>tazpkg add-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
135 <action>refresh:UNDIGEST_LIST</action>
136 </button>
137 <button>
138 <label>Remove</label>
139 <input file icon="gtk-remove"></input>
140 <action>xterm -T "Remove undigest" -geometry 80x16+120+120 -e "tazpkg remove-undigest $UNDIGEST_NAME; sleep 2"</action>
141 <action>refresh:UNDIGEST_LIST</action>
142 </button>
143 <button>
144 <label>Update</label>
145 <input file icon="reload"></input>
146 <action>tazpkg setup-undigest "$UNDIGEST_NAME" $UNDIGEST_URL</action>
147 <action>refresh:UNDIGEST_LIST</action>
148 </button>
149 <button>
150 <input file icon="gtk-close"></input>
151 <action type="closewindow">SETUP_UNDIGEST</action>
152 </button>
153 </hbox>
154 </vbox>
155 </window>
156 '
158 # Scan notifycation
159 desktopbox notify "Scanning packages database" 6 &
161 # Main dialog
162 export TAZPKG_DIALOG='
163 <window title="SliTaz Packages Manager" icon-name="package-x-generic">
164 <vbox>
166 <hbox>
167 <text use-markup="true">
168 <label>"<b>Packages Manager</b>"</label>
169 </text>
170 <pixmap>
171 <input file>/usr/share/pixmaps/tazpkg.png</input>
172 </pixmap>
173 </hbox>
175 <notebook labels="Packages|Search|Undigest|Configuration">
177 <vbox>
178 <tree>
179 <width>620</width><height>240</height>
180 <variable>PKG</variable>
181 <label>Name|Version|Description</label>
182 <input icon_column="0">$LIB/list all</input>
183 <action>echo "$PKG" > /tmp/tazpkgbox/pkg</action>
184 <action>$LIB/package_infos</action>
185 <action>refresh:PKG</action>
186 <action>refresh:GETIT</action>
187 <action>refresh:PKG_STATS</action>
188 <action>refresh:CACHE_STATS</action>
189 </tree>
190 <hbox>
191 <text>
192 <label>"Status:"</label>
193 </text>
194 <combobox>
195 <variable>STATUS</variable>
196 <item>all</item>
197 <item>installed</item>
198 <item>installable</item>
199 <item>blocked</item>
200 </combobox>
201 <text>
202 <label>"Category:"</label>
203 </text>
204 <combobox>
205 <variable>CAT</variable>
206 <item>all</item>
207 <item>base-system</item>
208 <item>x-window</item>
209 <item>utilities</item>
210 <item>network</item>
211 <item>graphics</item>
212 <item>multimedia</item>
213 <item>office</item>
214 <item>development</item>
215 <item>system-tools</item>
216 <item>security</item>
217 <item>games</item>
218 <item>misc</item>
219 <item>meta</item>
220 <item>non-free</item>
221 </combobox>
222 <button>
223 <label>List</label>
224 <input file icon="reload"></input>
225 <action>echo "$CAT" > /tmp/tazpkgbox/category</action>
226 <action>echo "$STATUS" > /tmp/tazpkgbox/status</action>
227 <action>refresh:PKG</action>
228 </button>
229 </hbox>
230 </vbox>
232 <vbox>
233 <tree>
234 <width>620</width><height>120</height>
235 <variable>RESULT</variable>
236 <label>Packages Name|Version|Description / File</label>
237 <input icon_column="0">cat /tmp/tazpkgbox/search</input>
238 <action>echo "$RESULT" > /tmp/tazpkgbox/pkg</action>
239 <action>$LIB/package_infos</action>
240 <action>$LIB/search</action>
241 <action>refresh:RESULT</action>
242 <action>refresh:PKG</action>
243 <action>refresh:PKG_STATS</action>
244 <action>refresh:CACHE_STATS</action>
245 </tree>
246 <hbox>
247 <entry>
248 <variable>SEARCH</variable>
249 </entry>
250 <button>
251 <label>Packages</label>
252 <input file icon="system-search"></input>
253 <action>$LIB/search packages</action>
254 <action>refresh:RESULT</action>
255 </button>
256 <button>
257 <label>Files</label>
258 <input file icon="system-search"></input>
259 <action>$LIB/search files</action>
260 <action>refresh:RESULT</action>
261 </button>
262 </hbox>
263 </vbox>
265 <vbox>
266 <tree>
267 <width>620</width><height>240</height>
268 <variable>DEV</variable>
269 <label>Package name|Version|Description</label>
270 <input>$LIB/list undigest</input>
271 <action>echo "$DEV" > /tmp/tazpkgbox/pkg</action>
272 <action>$LIB/package_infos</action>
273 <action>refresh:PKG</action>
274 <action>refresh:GETIT</action>
275 <action>refresh:PKG_STATS</action>
276 <action>refresh:CACHE_STATS</action>
277 </tree>
278 <hbox>
279 <button>
280 <label>Setup undigest mirrors</label>
281 <input file icon="go-next"></input>
282 <action type="launch">SETUP_UNDIGEST</action>
283 </button>
284 </hbox>
285 <hbox>
286 <text>
287 <label>"Undigest:"</label>
288 </text>
289 <combobox>
290 <variable>UNDIGEST_ENTRY</variable>
291 '
292 for i in all $(ls /var/lib/tazpkg/undigest 2> /dev/null); do
293 TAZPKG_DIALOG="$TAZPKG_DIALOG <item>$i</item> "
294 done
295 tmp=' </combobox>
296 <text>
297 <label>"Category:"</label>
298 </text>
299 <combobox>
300 <variable>UNDIGEST_CAT</variable>
301 <item>all</item>
302 <item>base-system</item>
303 <item>x-window</item>
304 <item>utilities</item>
305 <item>network</item>
306 <item>graphics</item>
307 <item>multimedia</item>
308 <item>office</item>
309 <item>development</item>
310 <item>system-tools</item>
311 <item>security</item>
312 <item>games</item>
313 <item>misc</item>
314 <item>meta</item>
315 <item>non-free</item>
316 </combobox>
317 <button>
318 <label>List</label>
319 <input file icon="reload"></input>
320 <action>echo "$UNDIGEST_CAT $UNDIGEST_ENTRY" > /tmp/tazpkgbox/undigest-category</action>
321 <action>refresh:DEV</action>
322 </button>
323 </hbox>
324 </vbox>
326 <vbox>
327 <frame Files and Cache directory>
328 <text use-markup="true" width-chars="60" wrap="false">
329 <label>"
330 Lists, mirror URL and installed packages: <b>/var/lib/tazpkg</b>
331 The cache directory is used to store downloaded or repacked packages.
332 "</label>
333 </text>
334 <hbox>
335 <entry editable="false">
336 <input>cd /var/cache/tazpkg; echo "Packages: `ls | wc -l`, size: `du -sh $PWD`"</input>
337 <variable>CACHE_STATS</variable>
338 </entry>
339 <button>
340 <label>Clean cache</label>
341 <input file icon="go-next"></input>
342 <action>rm -rf /var/cache/tazpkg/*</action>
343 <action>refresh:CACHE_STATS</action>
344 </button>
345 </hbox>
346 </frame>
347 <frame Mirror URL>
348 <hbox>
349 <entry>
350 <input>head -n 1 /var/lib/tazpkg/mirror</input>
351 <variable>MIRROR</variable>
352 </entry>
353 <button>
354 <label>Setup</label>
355 <input file icon="go-next"></input>
356 <action>echo "$MIRROR" > /var/lib/tazpkg/mirror</action>
357 <action>clear:MIRROR</action>
358 <action>refresh:MIRROR</action>
359 </button>
360 <button>
361 <label>Add</label>
362 <input file icon="gtk-add"></input>
363 <action>echo "$MIRROR" >> /var/lib/tazpkg/mirror</action>
364 <action>clear:MIRROR</action>
365 <action>refresh:MIRROR</action>
366 </button>
367 </hbox>
368 </frame>
369 <hbox>
370 <frame Journal>
371 <hbox>
372 <button>
373 <label>Show journal</label>
374 <input file icon="find"></input>
375 <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>
376 </button>
377 </hbox>
378 </frame>
379 <frame Configuration files>
380 <hbox>
381 <button>
382 <label>Repack config</label>
383 <input file icon="edit-redo"></input>
384 <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>
385 </button>
386 <button>
387 <label>Config Files</label>
388 <input file icon="tazpkg"></input>
389 <action type="launch">LIST_CONFIG_FILES</action>
390 </button>
391 </hbox>
392 </frame>
393 <frame Packages check>
394 <hbox>
395 <button>
396 <label>Quick check</label>
397 <input file icon="go-next"></input>
398 <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>
399 </button>
400 <button>
401 <label>Full check</label>
402 <input file icon="go-next"></input>
403 <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>
404 </button>
405 </hbox>
406 </frame>
407 </hbox>
408 </vbox>
410 </notebook>
412 <hbox>
413 <text wrap="false">
414 <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 "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>
415 <variable>PKG_STATS</variable>
416 </text>
417 </hbox>
419 <hbox>
420 <button>
421 <label>Recharge lists</label>
422 <input file icon="system-software-update"></input>
423 <action>xterm -T "Recharge" -geometry 80x16+120+120 -e "tazpkg recharge; sleep 2" 2>/dev/null</action>
424 <action>refresh:DEV</action>
425 <action>refresh:GET</action>
426 <action>refresh:GETIT</action>
427 <action>refresh:PKG_STATS</action>
428 </button>
429 <button>
430 <label>Upgrade all</label>
431 <input file icon="system-software-update"></input>
432 <action>xterm -T "Package upgrade" -geometry 80x16+120+120 -e "tazpkg upgrade; sleep 2" 2>/dev/null</action>
433 <action>refresh:PKG</action>
434 <action>refresh:DEV</action>
435 <action>refresh:GET</action>
436 <action>refresh:GETIT</action>
437 <action>refresh:PKG_STATS</action>
438 <action>refresh:CACHE_STATS</action>
439 </button>
440 <button>
441 <label>Wok</label>
442 <input file icon="gtk-open"></input>
443 <action>firefox http://hg.slitaz.org/wok/file/</action>
444 </button>
445 <button help>
446 <label>Help</label>
447 <action type="launch">HELP</action>
448 </button>
449 <button>
450 <label>Exit</label>
451 <input file icon="exit"></input>
452 <action type="exit">Exit</action>
453 </button>
454 </hbox>
456 </vbox>
458 </window>
459 '
460 TAZPKG_DIALOG="$TAZPKG_DIALOG$tmp"
462 gtkdialog --center --program=TAZPKG_DIALOG >/dev/null
464 exit 0