tazlito view tazlitobox @ rev 135
Update Makefile
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Jan 23 16:36:46 2010 +0100 (2010-01-23) |
parents | 1cc96a18d594 |
children | f2b3006d4e42 |
line source
1 #! /bin/sh
2 #
3 # Gtkdialog box for Tazlito - SliTaz Live Tool.
4 #
5 VERSION=2.2
7 export BIN=$0
9 # Check if user is root.
10 check_root()
11 {
12 if test $(id -u) != 0 ; then
13 echo -e "
14 You must be root to run `basename $0`. Please type 'su' and
15 root password to become super-user.\n"
16 exit 0
17 fi
18 }
20 # By default we go in /home/slitaz to download or gen flavors.
21 cd_flavors()
22 {
23 mkdir -p /home/slitaz/flavors
24 cd /home/slitaz
25 }
27 # We need to parse flavors.list for GTK tree.
28 list_flavors()
29 {
30 tazlito list-flavors | grep ^[a-z] | while read line
31 do
32 info=`echo -n $line | awk '{print $1 " " $2 " " $3}'`
33 printinfo=`echo -n $line | awk '{print $1 "|" $2 "|" $3}'`
34 echo "$printinfo|`echo $line | sed s/\"$info\"//`"
35 done
36 }
38 recharge_list()
39 {
40 xterm -geometry 90x14 \
41 -title "list-flavors --recharge" \
42 -e "tazlito list-flavors --recharge | grep ^[a-z] && sleep 2"
43 }
45 # When using gen-liveflavor, gen-flavor or gen-distro, user can put some
46 # addfiles copied into the rootfs.
47 addfiles_action()
48 {
49 cd /home/slitaz
50 mkdir -p distro/addfiles/rootfs
51 mkdir -p distro/addfiles/rootcd
52 file-manager distro/addfiles &
53 }
55 export HELP='
56 <window title="Tazlito Box - Help" icon-name="media-cdrom">
57 <vbox>
58 <text use-markup="true">
59 <label>"
60 <b>Tazlito Box - Help</b>"
61 </label>
62 </text>
64 <frame Overview>
65 <text wrap="true" width-chars="52" use-markup="true">
66 <label>
67 "
68 Tazlito Box is a tiny interface to the SliTaz Live Tool aka Tazlito.
69 You can simply generate a LiveCD in a few minutes, using your
70 own flavor or one from the SliTaz community. Tazlito can also
71 generate a LiveCD flavor using all of the currently installed
72 packages. Tazlito commands are executed in a XTerm, you can
73 press ENTER or the mouse to close the window.
74 "
75 </label>
76 </text>
77 </frame>
79 <frame Default paths>
80 <text wrap="true" width-chars="50" use-markup="true">
81 <label>
82 "
83 Distro : /home/slitaz/distro
84 Flavors : /home/slitaz/flavors
85 Packages : /home/slitaz/packages
86 "
87 </label>
88 </text>
89 </frame>
91 <hbox>
92 <button>
93 <input file icon="exit"></input>
94 <action type="closewindow">HELP</action>
95 </button>
96 </hbox>
98 </vbox>
99 </window>
100 '
102 # List all flavors on the mirror.
103 export LIST_FLAVORS_BOX='
104 <window title="Community flavors list" icon-name="tazlito">
105 <vbox>
106 <tree>
107 <width>500</width><height>200</height>
108 <variable>COMMUNITY_FLAVOR</variable>
109 <label>Name|ISO|Rootfs|Description</label>
110 <input exported_column="0">$BIN list_flavors</input>
111 </tree>
112 <hbox>
113 <button>
114 <label>Recharge list</label>
115 <input file icon="reload"></input>
116 <action>$BIN recharge_list</action>
117 <action>refresh:COMMUNITY_FLAVOR</action>
118 </button>
119 <button>
120 <label>Exit</label>
121 <input file icon="exit"></input>
122 <action type="closewindow">LIST_FLAVORS_BOX</action>
123 </button>
124 </hbox>
125 </vbox>
126 </window>'
128 # Execute tazlito commands in a XTerm. Notebook: tab-pos="GTK_POS_LEFT"
129 export TAZLITO_BOX='
130 <window title="Tazlito Box" icon-name="media-cdrom">
131 <vbox>
133 <hbox>
134 <text use-markup="true">
135 <label>"<b>SliTaz Live Tool</b>"</label>
137 </text>
138 <pixmap>
139 <input file>/usr/share/pixmaps/tazlito.png</input>
140 </pixmap>
142 </hbox>
144 <notebook labels="Writeiso|Live flavor|Flavors list|Gen flavor|Configuration files">
146 <frame Filesystem to ISO>
148 <text wrap="true" width-chars="60" use-markup="true">
149 <label>
150 "
151 Writeiso will generate an ISO image of the current filesystem as
152 is, including the /home directory. It is an easy way to remaster a
153 SliTaz Live system, you just have to: boot, modify, writeiso.
154 "
155 </label>
156 </text>
158 <hbox>
159 <text use-markup="true">
160 <label>"<b>Compression :</b> (gzip,lzma,none)"</label>
161 </text>
162 <entry>
163 <default>gzip</default>
164 <variable>COMPRESSION</variable>
165 </entry>
166 </hbox>
168 <hbox>
169 <button>
170 <label>Writeiso</label>
171 <input file icon="forward"></input>
172 <action>xterm -geometry 80x16 -title "writeiso" -e "tazlito writeiso $COMPRESSION"</action>
173 </button>
174 </hbox>
175 </frame>
177 <frame Current packages selection>
178 <text wrap="true" width-chars="60" use-markup="true">
179 <label>
180 "
181 Gen Live flavor will create a LiveCD based on all the currently
182 installed packages. To build the rootfs and ISO image it will use
183 original SliTaz packages. Some addfiles can be copied before
184 gen distro.
185 "
186 </label>
187 </text>
189 <hbox>
190 <text use-markup="true">
191 <label>"<b>Flavor name :</b>"</label>
192 </text>
193 <entry>
194 <default>slitaz</default>
195 <variable>GEN_LIVEFLAVOR_NAME</variable>
196 </entry>
197 </hbox>
199 <hbox>
200 <button>
201 <label>Addfiles</label>
202 <input file icon="gtk-open"></input>
203 <action>$BIN addfiles_action</action>
204 </button>
205 <button>
206 <label>Gen distro</label>
207 <input file icon="forward"></input>
208 <action>cd /home/slitaz</action>
209 <action>sed -i "s/ISO_NAME=.*/ISO_NAME=\"slitaz-$GEN_LIVEFLAVOR_NAME\"/" /etc/tazlito/tazlito.conf</action>
210 <action>xterm -geometry 80x16 -title "gen-liveflavor" -e "tazlito gen-liveflavor $GEN_LIVEFLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"</action>
211 </button>
212 <button>
213 <label>Clean distro</label>
214 <input file icon="edit-clear"></input>
215 <action>cd /home/slitaz</action>
216 <action>xterm -geometry 80x16 -title "clean-distro" -e "tazlito clean-distro && sleep 1"</action>
217 </button>
218 </hbox>
220 </frame>
222 <frame Community and personal flavors>
223 <text wrap="true" width-chars="60" use-markup="true">
224 <label>
225 "
226 Get and build preconfigured flavors from the community. Flavors
227 list can be recharged from SliTaz mirror.
228 "
229 </label>
230 </text>
232 <hbox>
233 <text use-markup="true">
234 <label>"<b>Flavor :</b>"</label>
235 </text>
236 <entry>
237 <default>core</default>
238 <variable>COMMUNITY_FLAVOR</variable>
239 </entry>
240 <button>
241 <label>List flavors</label>
242 <input file icon="media-cdrom"></input>
243 <action type="launch">LIST_FLAVORS_BOX</action>
244 </button>
245 </hbox>
247 <hbox>
248 <button>
249 <label>Get flavor</label>
250 <input file icon="forward"></input>
251 <action>xterm -geometry 80x16 -title "get-flavor $COMMUNITY_FLAVOR" -e "tazlito get-flavor $COMMUNITY_FLAVOR && echo -e \"----\nENTER to continue...\" && read close"</action>
252 </button>
253 <button>
254 <label>Gen distro</label>
255 <input file icon="forward"></input>
256 <action>xterm -geometry 80x16 -title "gen-distro" -e "tazlito gen-distro && echo -e \"----\nENTER to continue...\" && read close"</action>
257 </button>
258 <button>
259 <label>Clean distro</label>
260 <input file icon="edit-clear"></input>
261 <action>xterm -geometry 80x16 -title "clean-distro" -e "tazlito clean-distro && sleep 1"</action>
262 </button>
263 </hbox>
264 </frame>
266 <frame Generate a flavor>
268 <text wrap="true" width-chars="60" use-markup="true">
269 <label>
270 "
271 Gen Flavor will generate a new flavor file based on rootfs in
272 home/slitaz/distro. All addfiles will be included in the flavor file.
273 "
274 </label>
275 </text>
277 <hbox>
278 <text use-markup="true">
279 <label>"<b>New flavor :</b>"</label>
280 </text>
281 <entry>
282 <default>slitaz</default>
283 <variable>GEN_FLAVOR_NAME</variable>
284 </entry>
285 </hbox>
286 <hbox>
287 <button>
288 <label>Addfiles</label>
289 <input file icon="gtk-open"></input>
290 <action>$BIN addfiles_action</action>
291 </button>
292 <button>
293 <label>Gen new flavor</label>
294 <input file icon="forward"></input>
295 <action>xterm -geometry 80x16 -title "gen-flavor $GEN_FLAVOR_NAME" -e "tazlito gen-flavor $GEN_FLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"</action>
296 </button>
297 </hbox>
298 </frame>
300 <frame Flavor config and packages list>
301 <text wrap="true" width-chars="60" use-markup="true">
302 <label>
303 "
304 Before editing files you must have a flavor description.
305 "
306 </label>
307 </text>
309 <hbox>
310 <text use-markup="true">
311 <label>"<b>Flavor config :</b>"</label>
312 </text>
313 <entry>
314 <default>/home/slitaz/tazlito.conf</default>
315 <variable>CONFIG_FILE</variable>
316 </entry>
317 <button>
318 <input file icon="accessories-text-editor"></input>
319 <action>editor $CONFIG_FILE</action>
320 </button>
321 </hbox>
323 <hbox>
324 <text use-markup="true">
325 <label>"<b>Packages list :</b>"</label>
326 </text>
327 <entry>
328 <default>/home/slitaz/distro-packages.list</default>
329 <variable>PKGS_LIST</variable>
330 </entry>
331 <button>
332 <input file icon="accessories-text-editor"></input>
333 <action>editor $PKGS_LIST</action>
334 </button>
335 </hbox>
337 </frame>
339 </notebook>
341 <hbox>
342 <button help>
343 <input file icon="help-browser"></input>
344 <action type="launch">HELP</action>
345 </button>
346 <button>
347 <label>Exit</label>
348 <input file icon="exit"></input>
349 <action type="exit">Exit</action>
350 </button>
351 </hbox>
353 </vbox>
354 </window>
355 '
357 case $1 in
358 *_*)
359 # Exec all function called by args (must have an underscore).
360 $1 ;;
361 *)
362 # Tazlitobox action
363 check_root
364 cd_flavors
365 gtkdialog --center --program=TAZLITO_BOX ;;
366 esac
368 exit 0