flavors view core/rootfs/usr/bin/tazlitobox @ rev 15

Keep 4 flavors + loram + 3in1 and add tmp addfiles for core
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 02 22:26:52 2010 +0100 (2010-02-02)
parents
children
line source
1 #!/bin/sh
2 #
3 # Gtkdialog box for Tazlito - SliTaz Live Tool.
4 # Tabs are used for ident ans all action should go into functions to
5 # separate GUI and commands.
6 #
7 # (C) GNU gpl v3 - SliTaz GNU/Linux 2010.
8 #
9 VERSION=2.2
11 export BIN=$0
13 # Check if user is root.
14 check_root()
15 {
16 if test $(id -u) != 0 ; then
17 echo -e "
18 You must be root to run `basename $0`. Please type 'su' and
19 root password to become super-user.\n"
20 exit 0
21 fi
22 }
24 # We need to parse flavors.list for GTK tree.
25 list_flavors()
26 {
27 tazlito list-flavors | grep ^[a-z] | while read line
28 do
29 info=`echo -n $line | awk '{print $1 " " $2 " " $3}'`
30 printinfo=`echo -n $line | awk '{print $1 "|" $2 "|" $3}'`
31 echo "$printinfo|`echo $line | sed s/\"$info\"//`"
32 done
33 }
35 recharge_list()
36 {
37 xterm -geometry 90x14 \
38 -title "list-flavors --recharge" \
39 -e "tazlito list-flavors --recharge | grep ^[a-z] && sleep 2"
40 }
42 # When using gen-liveflavor, gen-flavor or gen-distro, user can put some
43 # addfiles copied into the rootfs.
44 addfiles_action()
45 {
46 cd /home/slitaz
47 mkdir -p distro/addfiles/rootfs/usr/share/images
48 mkdir -p distro/addfiles/rootcd
49 file-manager distro/addfiles &
50 }
52 writeiso_action()
53 {
54 xterm -geometry 80x16 \
55 -title "writeiso" \
56 -e "tazlito writeiso $COMPRESSION"
57 }
59 gen_liveflavor_action()
60 {
61 cd /home/slitaz
62 sed -i "s/ISO_NAME=.*/ISO_NAME=\"slitaz-$GEN_LIVEFLAVOR_NAME\"/" \
63 /etc/tazlito/tazlito.conf
64 xterm -geometry 80x16 \
65 -title "gen-liveflavor" \
66 -e "tazlito gen-liveflavor $GEN_LIVEFLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"
67 }
69 clean_distro_action()
70 {
71 cd /home/slitaz
72 xterm -geometry 80x16 \
73 -title "clean-distro" \
74 -e "tazlito clean-distro && sleep 1"
75 }
77 get_flavor_action()
78 {
79 cd /home/slitaz
80 xterm -geometry 80x16 \
81 -title "get-flavor $COMMUNITY_FLAVOR" \
82 -e "tazlito get-flavor $COMMUNITY_FLAVOR && echo -e \"----\nENTER to continue...\" && read close"
83 }
85 gen_distro_action()
86 {
87 cd /home/slitaz
88 xterm -geometry 80x16 \
89 -title "gen-distro" \
90 -e "tazlito gen-distro && echo -e \"----\nENTER to continue...\" && read close"
91 }
93 gen_flavor_action()
94 {
95 cd /home/slitaz
96 xterm -geometry 80x16 \
97 -title "gen-flavor $GEN_FLAVOR_NAME" \
98 -e "tazlito gen-flavor $GEN_FLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"
99 }
101 edit_distro_script()
102 {
103 [ ! -f $DISTRO_SCRIPT ] && echo "#!/bin/sh" > $DISTRO_SCRIPT
104 chmod +x $DISTRO_SCRIPT
105 editor $DISTRO_SCRIPT
106 }
108 # Boxes
110 export HELP='
111 <window title="Tazlito Box - Help" icon-name="media-cdrom">
112 <vbox>
113 <text use-markup="true">
114 <label>"
115 <b>Tazlito Box - Help</b>"
116 </label>
117 </text>
119 <frame Overview>
120 <text wrap="true" width-chars="52" use-markup="true">
121 <label>
122 "
123 Tazlito Box is a tiny interface to the SliTaz Live Tool aka Tazlito.
124 You can simply generate a LiveCD in a few minutes, using your
125 own flavor or one from the SliTaz community. Tazlito can also
126 generate a LiveCD flavor using all of the currently installed
127 packages. Tazlito commands are executed in a XTerm, you can
128 press ENTER or the mouse to close the window.
129 "
130 </label>
131 </text>
132 </frame>
134 <frame Default paths>
135 <text wrap="true" width-chars="50" use-markup="true">
136 <label>
137 "
138 Distro : /home/slitaz/distro
139 Flavors : /home/slitaz/flavors
140 Packages : /home/slitaz/packages
141 "
142 </label>
143 </text>
144 </frame>
146 <hbox>
147 <button>
148 <input file icon="exit"></input>
149 <action type="closewindow">HELP</action>
150 </button>
151 </hbox>
153 </vbox>
154 </window>
155 '
157 # List all flavors on the mirror.
158 export LIST_FLAVORS_BOX='
159 <window title="Community flavors list" icon-name="tazlito">
160 <vbox>
161 <tree>
162 <width>500</width><height>200</height>
163 <variable>COMMUNITY_FLAVOR</variable>
164 <label>Name|ISO|Rootfs|Description</label>
165 <input exported_column="0">$BIN list_flavors</input>
166 </tree>
167 <hbox>
168 <button>
169 <label>Recharge list</label>
170 <input file icon="reload"></input>
171 <action>$BIN recharge_list</action>
172 <action>refresh:COMMUNITY_FLAVOR</action>
173 </button>
174 <button>
175 <label>Exit</label>
176 <input file icon="exit"></input>
177 <action type="closewindow">LIST_FLAVORS_BOX</action>
178 </button>
179 </hbox>
180 </vbox>
181 </window>'
183 # Execute tazlito commands in a XTerm. Notebook: tab-pos="GTK_POS_LEFT"
184 export TAZLITO_BOX='
185 <window title="Tazlito Box" icon-name="media-cdrom">
186 <vbox>
188 <hbox>
189 <text use-markup="true">
190 <label>"<b>SliTaz Live Tool</b>"</label>
191 </text>
192 <pixmap>
193 <input file>/usr/share/pixmaps/tazlito.png</input>
194 </pixmap>
195 </hbox>
197 <notebook labels="Writeiso|Live flavor|Flavors list|Gen flavor|Configuration">
199 <frame Filesystem to ISO>
201 <text wrap="true" width-chars="60" use-markup="true">
202 <label>
203 "
204 Writeiso will generate an ISO image of the current filesystem as
205 is, including the /home directory. It is an easy way to remaster a
206 SliTaz Live system, you just have to: boot, modify, writeiso.
207 "
208 </label>
209 </text>
211 <hbox>
212 <text use-markup="true">
213 <label>"<b>Compression (gzip,lzma,none):</b>"</label>
214 </text>
215 <entry>
216 <default>gzip</default>
217 <variable>COMPRESSION</variable>
218 </entry>
219 </hbox>
221 <hbox>
222 <button>
223 <label>Writeiso</label>
224 <input file icon="forward"></input>
225 <action>$BIN writeiso_action</action>
226 </button>
227 </hbox>
229 </frame>
231 <frame Current packages selection>
233 <text wrap="true" width-chars="60" use-markup="true">
234 <label>
235 "
236 Gen Live flavor will create a LiveCD based on all the currently
237 installed packages. To build the rootfs and ISO image it will use
238 original SliTaz packages. Some addfiles can be copied before
239 gen distro.
240 "
241 </label>
242 </text>
244 <hbox>
245 <text use-markup="true">
246 <label>"<b>Flavor name :</b>"</label>
247 </text>
248 <entry>
249 <default>slitaz</default>
250 <variable>GEN_LIVEFLAVOR_NAME</variable>
251 </entry>
252 </hbox>
254 <hbox>
255 <button>
256 <label>Addfiles</label>
257 <input file icon="gtk-open"></input>
258 <action>$BIN addfiles_action</action>
259 </button>
260 <button>
261 <label>Gen distro</label>
262 <input file icon="forward"></input>
263 <action>$BIN gen_liveflavor_action</action>
264 </button>
265 <button>
266 <label>Clean distro</label>
267 <input file icon="edit-clear"></input>
268 <action>$BIN clean_distro_action</action>
269 </button>
270 </hbox>
272 </frame>
274 <frame Community and personal flavors>
276 <text wrap="true" width-chars="60" use-markup="true">
277 <label>
278 "
279 Get and build preconfigured flavors from the community. Flavors
280 llist can be recharged from SliTaz mirror. Some addfiles can be
281 copied before generating the distro.
282 "
283 </label>
284 </text>
286 <hbox>
287 <text use-markup="true">
288 <label>"<b>Flavor :</b>"</label>
289 </text>
290 <entry>
291 <default>core</default>
292 <variable>COMMUNITY_FLAVOR</variable>
293 </entry>
294 <button>
295 <label>List flavors</label>
296 <input file icon="media-cdrom"></input>
297 <action type="launch">LIST_FLAVORS_BOX</action>
298 </button>
299 </hbox>
301 <hbox>
302 <button>
303 <label>Get flavor</label>
304 <input file icon="forward"></input>
305 <action>$BIN get_flavor_action</action>
306 </button>
307 <button>
308 <label>Addfiles</label>
309 <input file icon="gtk-open"></input>
310 <action>$BIN addfiles_action</action>
311 </button>
312 <button>
313 <label>Gen distro</label>
314 <input file icon="forward"></input>
315 <action>$BIN gen_distro_action</action>
316 </button>
317 <button>
318 <label>Clean distro</label>
319 <input file icon="edit-clear"></input>
320 <action>$BIN clean_distro_action</action>
321 </button>
322 </hbox>
324 </frame>
325 <frame Generate a flavor>
327 <text wrap="true" width-chars="60" use-markup="true">
328 <label>
329 "
330 Gen Flavor will generate a new flavor file based on rootfs in
331 /home/slitaz/distro. All addfiles will be included in the flavor file.
332 "
333 </label>
334 </text>
336 <hbox>
337 <text use-markup="true">
338 <label>"<b>New flavor :</b>"</label>
339 </text>
340 <entry>
341 <default>slitaz</default>
342 <variable>GEN_FLAVOR_NAME</variable>
343 </entry>
344 </hbox>
346 <hbox>
347 <button>
348 <label>Addfiles</label>
349 <input file icon="gtk-open"></input>
350 <action>$BIN addfiles_action</action>
351 </button>
352 <button>
353 <label>Gen new flavor</label>
354 <input file icon="forward"></input>
355 <action>$BIN gen_flavor_action</action>
356 </button>
357 </hbox>
359 </frame>
361 <frame Flavor config and packages list>
363 <text wrap="true" width-chars="60" use-markup="true">
364 <label>
365 "
366 Before editing files you must have a flavor description. Distro
367 script can be used to perform actions into the rootfs before
368 compression.
369 "
370 </label>
371 </text>
373 <hbox>
374 <text use-markup="true">
375 <label>"<b>Flavor config :</b>"</label>
376 </text>
377 <entry>
378 <default>/home/slitaz/tazlito.conf</default>
379 <variable>CONFIG_FILE</variable>
380 </entry>
381 <button>
382 <input file icon="accessories-text-editor"></input>
383 <action>editor $CONFIG_FILE</action>
384 </button>
385 </hbox>
387 <hbox>
388 <text use-markup="true">
389 <label>"<b>Packages list :</b>"</label>
390 </text>
391 <entry>
392 <default>/home/slitaz/distro-packages.list</default>
393 <variable>PKGS_LIST</variable>
394 </entry>
395 <button>
396 <input file icon="accessories-text-editor"></input>
397 <action>editor $PKGS_LIST</action>
398 </button>
399 </hbox>
401 <hbox>
402 <text use-markup="true">
403 <label>"<b>Distro script :</b> "</label>
404 </text>
405 <entry>
406 <default>/home/slitaz/distro.sh</default>
407 <variable>DISTRO_SCRIPT</variable>
408 </entry>
409 <button>
410 <input file icon="accessories-text-editor"></input>
411 <action>$BIN edit_distro_script</action>
412 </button>
413 </hbox>
415 </frame>
417 </notebook>
419 <hbox>
420 <button help>
421 <input file icon="help-browser"></input>
422 <action type="launch">HELP</action>
423 </button>
424 <button>
425 <label>Exit</label>
426 <input file icon="exit"></input>
427 <action type="exit">Exit</action>
428 </button>
429 </hbox>
431 </vbox>
432 </window>
433 '
435 case $1 in
436 *_*)
437 # Exec all function called by args (must have an underscore).
438 $1 ;;
439 *)
440 # Tazlitobox action.
441 check_root
442 gtkdialog --center --program=TAZLITO_BOX ;;
443 esac
445 exit 0