slitaz-tools view tinyutils/bootfloppybox @ rev 390
Add desktop file for Documentation --> GNU GPL
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Oct 01 21:38:06 2009 +0200 (2009-10-01) |
parents | e9ddf09500d2 |
children | b158266db011 |
line source
1 #! /bin/sh
2 #
3 # Gtkdialog box for the mount command. Part of SliTaz tools.
4 #
5 VERSION=20081121
7 # Check if user is root.
8 check_root()
9 {
10 if test $(id -u) != 0 ; then
11 echo -e "
12 You must be root to run `basename $0`. Please type 'su' and
13 root password to become super-user.\n"
14 exit 0
15 fi
16 }
18 # This function is used after each screen to contine or abort install.
19 check_retval()
20 {
21 case $retval in
22 1)
23 rm -f /tmp/floppybox.grub.menu
24 echo -e "\nVoluntary exit.\n" && exit 0 ;;
25 255)
26 rm -f /tmp/floppybox.grub.menu
27 echo -e "ESC pressed.\n" && exit 0 ;;
28 esac
29 }
31 select_floppy()
32 {
33 DEVICE="$DIALOG --title \" Floppy device \" --backtitle \"Boot Floppy Creation\" --clear --extra-button --extra-label \"Format\" --colors --radiolist \"
34 Select boot device
35 \" 18 70 50"
36 on=on
37 for i in /sys/devices/platform/floppy.*/block:*; do
38 [ -d $i ] || continue
39 DEVICE="$DEVICE /dev/${i#*block:} 'Floppy in ${i#*block:}' $on"
40 on=off
41 done
42 DEVICE="$DEVICE floppy \"cdrom image file boot.iso\" $on"
43 DEVICE="$DEVICE cdrom \"floppy image file boot.fd\" off 2>&1 1>&3"
44 exec 3>&1
45 DEVICE=`eval $DEVICE`
46 retval=$?
47 exec 3>&-
48 check_retval
49 if [ "$retval" = "3" ]; then
50 case "$DEVICE" in
51 /dev/*) fdformat -n $DEVICE;;
52 esac
53 fi
54 }
56 mkmenu()
57 {
58 if [ "$1" = "grub4dos" ]; then
59 SAVEDEFAULT="save default"
60 cat > /tmp/floppybox.grub.menu <<EOT
61 # grub4dos menu
62 default /default
63 EOT
64 else
65 SAVEDEFAULT="savedefault"
66 cat > /tmp/floppybox.grub.menu <<EOT
67 # grub menu
68 default saved
69 EOT
70 fi
71 cat >> /tmp/floppybox.grub.menu <<EOT
72 timeout 8
73 color yellow/brown light-green/black
75 EOT
76 entry=0
77 [ -f /boot/gpxe ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
78 title gPXE (Boot from the Web, PXE/iSCSI/AoE support)
79 kernel /boot/gpxe $(dd if=/boot/gpxe bs=1 skip=519 count=255 2>/dev/null | strings)
81 EOT
82 [ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
83 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
84 title Smart Boot Manager (text - boot floppy, hard disk or CD/DVD)
85 kernel /boot/memdisk floppy c=80 h=2 s=18
86 initrd /boot/btmgr.gz
88 EOT
89 http://mirror.slitaz.org/boot/plpbt.bin
90 [ -f /usr/share/boot/plpbt.bin ] \
91 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
92 title Plop Boot Manager (graphic - boot floppy, hard disk, CD/DVD or USB)
93 kernel /boot/plpbt.bin
95 EOT
96 [ -f /usr/share/boot/etherboot ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
97 title Etherboot (LAN boot, PXE or NBI)
98 kernel /boot/etherboot
100 EOT
101 [ -f /usr/share/boot/memtest.lzma -a -f /usr/share/boot/memdisk.lzma ] \
102 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
103 title Memtest86+ (Test system memory)
104 kernel /boot/memdisk floppy c=80 h=2 s=18
105 initrd /boot/memtest.gz
107 EOT
108 [ "$1" = "grub4dos" ] && entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
109 title Windows (scan ntldr)
110 fallback $(($entry -3 + 1))
111 find --set-root /ntldr
112 chainloader /ntldr
113 $SAVEDEFAULT --wait=2
115 title Windows (scan cmldr)
116 fallback $(($entry -3 + 2))
117 find --set-root /cmldr
118 chainloader /cmldr
119 $SAVEDEFAULT --wait=2
121 title Windows (scan io.sys)
122 fallback $(($entry -3 + 3))
123 find --set-root /io.sys
124 chainloader /io.sys
125 $SAVEDEFAULT --wait=2
127 EOT
128 entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
129 title Windows (example on /dev/hda1)
130 rootnoverify (hd0,0)
131 chainloader +1
132 $SAVEDEFAULT
134 title Slitaz Frugal (example on /dev/hda1)
135 root (hd0,0)
136 kernel /boot/bzImage rw root=/dev/null vga=normal
137 initrd /boot/rootfs.gz
138 $SAVEDEFAULT
140 title Slitaz Installed (example on /dev/hda2)
141 root (hd0,1)
142 kernel /boot/bzImage ro root=/dev/hda2 vga=normal
143 $SAVEDEFAULT
145 EOT
146 [ "$1" = "grub4dos" ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
147 title Slitaz cdrom image (example on /dev/hda1, DEFRAGMENTED)
148 map (hd0,0)/boot/slitaz-cooking.iso (hd1)
149 map --hook
150 kernel (hd1)/boot/bzImage rw root=/dev/null vga=normal
151 initrd (hd1)/boot/rootfs.gz
152 $SAVEDEFAULT
154 EOT
155 false && [ -f /usr/share/boot/grub.exe.lzma ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
156 title Grub4Dos
157 kernel /boot/grub/grub.exe --config-file="configfile (fd0)/boot/grub/menu4dos.lst"
159 EOT
160 }
162 install_grub()
163 {
164 LOOP=""
165 GRUB_DEV=${DEVICE#/dev/}
166 GRUB_DEV=${GRUB_DEV%% *}
167 case "$DEVICE" in
168 floppy*)
169 LOOP="-o loop"
170 GRUB_DEV=fd0
171 DEVICE=boot.fd
172 dd if=/dev/zero of=$DEVICE bs=18k count=80;;
173 esac
174 grep -qs "^# $2 menu" /tmp/floppybox.grub.menu || mkmenu $2
175 case "$DEVICE" in
176 /dev/*|boot.fd)
177 yes y | mke2fs $DEVICE
178 mkdir /media/floppy
179 mount $LOOP $DEVICE /media/floppy
180 if [ "$2" = "grub4dos" ]; then
181 mkdir -p /media/floppy/boot
182 unlzma -c /usr/share/boot/grldr.lzma > /media/floppy/grldr
183 cp $1/boot/* /media/floppy/boot 2> /dev/null
184 cp /tmp/floppybox.grub.menu /media/floppy/menu.lst
185 umount -d /media/floppy
186 bootlace --floppy --sectors-per-track=18 --heads=2 \
187 --chs --ext2 $DEVICE
188 else
189 mkdir -p /media/floppy/boot/grub
190 cp /usr/lib/grub/i386-pc/stage? /media/floppy/boot/grub
191 cp -a $1/boot /media/floppy
192 cp /tmp/floppybox.grub.menu /media/floppy/boot/grub/menu.lst
193 grub-set-default --root-directory=/media/floppy 0
194 echo "($GRUB_DEV) $(losetup | grep $DEVICE | cut -d: -f1)" > $1/device.map
195 [ -n "$LOOP" ] && LOOP="--device-map=$1/device.map"
196 grub $LOOP --batch <<EOT
197 root ($GRUB_DEV)
198 setup ($GRUB_DEV)
199 quit
200 EOT
201 umount -d /media/floppy
202 fi ;;
203 cdrom*)
204 mkdir -p $1/boot/grub 2> /dev/null
205 cp /tmp/floppybox.grub.menu $1/boot/grub/menu.lst
206 if [ "$2" = "grub4dos" ]; then
207 unlzma -c /usr/share/boot/grldr.lzma > $1/boot/grub/grldr
208 genisoimage -R -o boot.iso -b boot/grub/grldr \
209 -c boot/boot.cat -no-emul-boot -boot-load-seg 0x1000 \
210 -hide boot/boot.cat -input-charset iso8859-1 $1
211 else
212 cp /usr/lib/grub/i386-pc/stage2_eltorito $1/boot/grub
213 genisoimage -R -o boot.iso -b boot/grub/stage2_eltorito \
214 -c boot/boot.cat -no-emul-boot -boot-load-size 4 \
215 -hide boot/boot.cat -input-charset iso8859-1 \
216 -boot-info-table $1
217 fi ;;
218 esac
219 }
221 while true; do
223 if [ "$1" == "call" ]; then
224 case "$2" in
225 mkmenu) mkmenu $3;;
226 install)
227 DIR=/tmp/mkbootfloppy$$
228 mkdir -p $DIR
229 DEVICE=$4
230 file=$5
231 case "$3" in
232 grub*)
233 mkdir -p $DIR/boot/grub
234 [ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
235 && cat /usr/share/boot/btmgr /dev/zero | \
236 dd bs=18k count=80 | gzip -9 > \
237 $DIR/boot/btmgr.gz \
238 && unlzma -c /usr/share/boot/memdisk.lzma > \
239 $DIR/boot/memdisk
240 [ -f /usr/share/boot/plpbt.bin ] \
241 && cp /usr/share/boot/plpbt.bin $DIR/boot
242 [ -f /usr/share/boot/etherboot ] \
243 && cp /usr/share/boot/etherboot $DIR/boot
244 [ -f /boot/gpxe ]\
245 && cp /boot/gpxe $DIR/boot
246 [ -f /usr/share/boot/memtest.lzma -a \
247 -f /usr/share/boot/memdisk.lzma ] \
248 && unlzma -c /usr/share/boot/memtest.lzma | \
249 cat - /dev/zero | dd bs=18k count=80 | \
250 gzip -9 > $DIR/boot/memtest.gz \
251 && unlzma -c /usr/share/boot/memdisk.lzma > \
252 $DIR/boot/memdisk
253 install_grub $DIR $3
254 ;;
255 *)
256 case "$file" in
257 *.lzma) action="unlzma -c";;
258 *.gz) action="zcat";;
259 *) action="cat";;
260 esac
261 case "$DEVICE" in
262 /dev/*) $action $file > $DEVICE;;
263 flopp*) $action $file | cat - /dev/zero | \
264 dd bs=18k count=80 > boot.fd;;
265 cdrom*)
266 mkdir -p $DIR/boot/grub
267 case "$3" in
268 btmgr|memtest)
269 $action $file | cat - /dev/zero | \
270 dd bs=18k count=80 | \
271 gzip -9 > $DIR/boot/$3.gz
272 unlzma -c /usr/share/boot/memdisk.lzma \
273 > $DIR/boot/memdisk
274 cat > /tmp/floppybox.grub.menu << EOT
275 # grub menu
276 timeout 0
277 title $3
278 kernel /boot/memdisk floppy c=80 h=2 s=18
279 initrd /boot/$3.gz
280 EOT
281 ;;
282 *) $action $file > $DIR/boot/$3
283 cat > /tmp/floppybox.grub.menu << EOT
284 # grub menu
285 timeout 0
286 title $3
287 kernel /boot/$3
288 EOT
289 ;;
290 esac
291 install_grub $DIR grub
292 ;;
293 esac
294 ;;
295 esac
296 rm -rf $DIR
297 ;;
298 get-plop)
299 mkdir -p /tmp/get-plop$$
300 PLOP_URL=http://mirror.slitaz.org/boot/plpbt.bin
301 wget -O - $PLOP_URL > /tmp/get-plop$$/plpbt.bin
302 VERSION="$(strings /tmp/get-plop$$/plpbt.bin \
303 | grep 'Boot Manager v' | sed 's/.* v\([0-9\.]*\) .*/\1/')"
304 mkdir -p $(dirname /tmp/get-plop$$/plop-$VERSION/fs/$3)
305 mv /tmp/get-plop$$/plpbt.bin \
306 /tmp/get-plop$$/plop-$VERSION/fs/$3
307 if [ -s /tmp/get-plop$$/plop-$VERSION/fs/$3 ]; then
308 cat > /tmp/get-plop$$/plop-$VERSION/receipt <<EOT
309 PACKAGE="plop"
310 VERSION="$VERSION"
311 CATEGORY="non-free"
312 SHORT_DESC="Plop boot manager."
313 WEB_SITE="http://www.plop.at/en/bootmanager.html"
314 EOT
315 ( cd /tmp/get-plop$$ ; tazpkg pack plop-$VERSION )
316 tazpkg install /tmp/get-plop$$/plop-$VERSION.tazpkg
317 fi
318 rm -rf /tmp/get-plop$$
319 ;;
320 *) echo "Invalid command $0 $@" 1>&2
321 exit 1;;
322 esac
323 exit 0
324 fi
326 if [ -z "$XAUTHORITY" ]; then
328 : ${DIALOG=dialog}
330 DEVICE=/dev/fd0
331 while true; do
332 exec 3>&1
333 ID_SOURCE=`$DIALOG --title " Choose a boot floppy " \
334 --backtitle "Boot Floppy Creation on $DEVICE" --clear \
335 --extra-button --extra-label "Change floppy" \
336 --yes-label "Install" \
337 --no-label "Quit" \
338 --colors --radiolist "
339 Create a floppy or a cdrom to boot a LiveCD in a PXE network...
340 May need a floppy disk in drive. Erase the whole floppy disk.
341 " 18 70 50\
342 SmartBtmgr "Boot any partition or ATAPI CD-ROM." on \
343 Plop "Boot USB harddisk floppy or CD/DVD." off \
344 Etherboot "Replacement for proprietary PXE ROMs." off \
345 gPXE "Boot from http://boot.slitaz.org/" off \
346 Memtest86+ "Memory failures detection tool." off \
347 Grub4DOS "Enhanced grub version supporting NTFS." off \
348 Grub "Boot loader with command shell." off 2>&1 1>&3`
349 retval=$?
350 exec 3>&-
351 check_retval
352 if [ "$retval" = "3" ]; then
353 select_floppy
354 continue;
355 fi
356 while read key file pkg; do
357 [ "$key" = "$ID_SOURCE" ] || continue
358 if [ ! -f "$file" ]; then
359 $DIALOG --title " Install package " --colors \
360 --backtitle "Boot Floppy Creation" --clear \
361 --yes-label "Install" \
362 --no-label "Quit" \
363 --yesno "The package $pkg is not yet installed. Install it ?" 18 70
364 retval=$?
365 if [ "$pkg" = "plop" ]; then
366 bootfloppybox call get-plop $file
367 else
368 tazpkg get-install $pkg
369 fi
370 fi
371 bootfloppybox call install "$pkg" "$DEVICE" "$file"
372 exit 0
373 done <<EOT
374 SmartBtmgr /usr/share/boot/btmgr btmgr
375 Plop /usr/share/boot/plpbt.bin plop
376 Etherboot /usr/share/boot/etherboot etherboot
377 gPXE /boot/gpxe gpxe
378 Memtest86+ /usr/share/boot/memtest.lzma memtest
379 Grub4DOS /usr/share/boot/grldr.lzma grub4dos
380 Grub /usr/sbin/grub grub
381 EOT
382 done
383 fi
384 #
385 # Describe gPXE arguments.
386 #
387 export HELP='
388 <window title="gPXE forced url" icon-name="gtk-floppy">
389 <vbox>
390 <text use-markup="true">
391 <label>"
392 <b>Web boot parameters</b>"
393 </label>
394 </text>
395 <frame>
396 <text wrap="true" width-chars="58" use-markup="true">
397 <label>
398 "Without parameters (i.e. with an empty Boot URL) gPXE will perform a normal PXE boot: IP configuration with DHCP and download the DHCP bootfile with TFTP.
400 You can override the DHCP bootfile with a Boot URL such as <i>tftp://192.168.0.1/pxe/pxeloader</i>, <i>http://mirror.slitaz.org/pxe/pxelinux.0</i>, or <i>x-tftm://192.168.0.201//lts/vmlinuz.ltsp</i>.
402 You can override IP configuration too (useful without a DHCP server), example: <i>ip=192.168.0.10/24 gw=192.168.0.1 dns=192.168.0.1 nodhcp url=http://mirror.slitaz.org/pxe/pxelinux.0</i>
404 The <i>nodhcp</i> keyword avoids dhcp timeouts and the <i>url=</i> keyword is optional when the url is the only one argument.
406 Comma separated URL lists are supported. The PXE client will try to load the first URL. If the load fails, it will try the next URL, and so on.
407 "
408 </label>
409 </text>
410 </frame>
411 </vbox>
412 </window>
413 '
414 #
415 # Read/write floppy images
416 #
417 export FLOPPY_IMAGE='
418 <window title="Floppy image manager" icon-name="gtk-floppy">
419 <vbox>
420 <frame Floppy disk drive>
421 <hbox>
422 <text use-markup="true">
423 <label>"<b>Device : </b>"</label>
424 </text>
425 <combobox>
426 <variable>DEVICE</variable>'
427 for i in /sys/devices/platform/floppy.*/block:*; do
428 [ -d $i ] || continue
429 FLOPPY_IMAGE="$FLOPPY_IMAGE
430 <item>/dev/${i#*block:}</item>"
431 done
432 FLOPPY_IMAGE="$FLOPPY_IMAGE
433 </combobox>
434 <button>
435 <label>Format floppy</label>
436 <input file icon=\"media-floppy\"></input>
437 <action>fdformat -n $DEVICE</action>
438 </button>
439 </hbox>
440 </frame>
441 <frame Floppy image file>
442 <hbox>
443 <text use-markup=\"true\">
444 <label>\"<b>File : </b>\"</label>
445 </text>
446 <entry accept=\"filename\">
447 <label>Select a floppy image</label>
448 <variable>IMAGE</variable>
449 </entry>
450 <button>
451 <input file stock=\"gtk-open\"></input>
452 <action type=\"fileselect\">IMAGE</action>
453 </button>
454 </hbox>
455 </frame>
456 <hbox>
457 <button>
458 <input file icon=\"go-jump\"></input>
459 <label>Write image to floppy</label>
460 <action>dd if=\$IMAGE of=\$DEVICE</action>
461 </button>
462 <button>
463 <input file icon=\"undo\"></input>
464 <label>Get floppy image</label>
465 <action>dd if=\$DEVICE of=\$IMAGE</action>
466 </button>
467 <button>
468 <input file icon=\"gtk-close\"></input>
469 <action type=\"closewindow\">FLOPPY_IMAGE</action>
470 </button>
471 </hbox>
472 </vbox>
473 </window>
474 "
475 #
476 # Write bootfloppy image to floppy device.
477 #
478 BOOT_DIALOG='
479 <window title="bootfloppybox" icon-name="gtk-floppy">
480 <vbox>
482 <text use-markup="true">
483 <label>
484 "
485 <b>SliTaz - Bootfloppybox</b>"
486 </label>
487 </text>
488 <text wrap="false" width-chars="44" use-markup="true">
489 <label>
490 "
491 Create a floppy or a cdrom to boot a LiveCD in a PXE network or the WEB...
492 May need a floppy disk in drive. Erase the whole floppy disk.
493 "
494 </label>
495 </text>
497 <frame Floppy disk drive>
498 <hbox>
499 <text use-markup="true">
500 <label>"<b>Device : </b>"</label>
501 </text>
502 <combobox>
503 <variable>DEVICE</variable>'
504 for i in /sys/devices/platform/floppy.*/block:*; do
505 [ -d $i ] || continue
506 BOOT_DIALOG="$BOOT_DIALOG
507 <item>/dev/${i#*block:}</item>"
508 done
509 tmp=' <item>floppy image (boot.fd)</item>
510 <item>cdrom image (boot.iso)</item>
511 </combobox>
512 <button>
513 <label>Format floppy</label>
514 <input file icon="media-floppy"></input>
515 <action>case "$DEVICE" in /dev/*) fdformat -n $DEVICE;; esac</action>
516 </button>
517 </hbox>
518 </frame>
519 <notebook labels="LiveCD|USB|PXE Network|WEB Network|Memory Test|Windows|Expert">
520 '
521 BOOT_DIALOG="$BOOT_DIALOG$tmp"
522 while read name file pkg desc; do
523 tmp="<frame $name>
524 <hbox>
525 <text wrap=\"true\" width-chars=\"44\" use-markup=\"true\">
526 <label>
527 \"
528 $(echo -e $desc)
529 \"
530 </label>
531 </text>
532 </hbox>
533 <hbox>
534 "
535 if [ -f $file ]; then
536 if [ "$pkg" = "grub" -o "$pkg" = "grub4dos" ]; then
537 tmp="$tmp
538 <button>
539 <label>Grub menu</label>
540 <input file icon=\"accessories-text-editor\"></input>
541 <action>bootfloppybox call mkmenu $pkg</action>
542 <action type=\"lauch\">leafpad /tmp/floppybox.grub.menu</action>
543 </button>
544 "
545 elif [ "$pkg" = "etherboot" ]; then
546 tmp="$tmp
547 <button>
548 <input file icon=\"browser\"></input>
549 <label>Wiki</label>
550 <action>firefox http://wiki.slitaz.org/doku.php?id=quickstart:pxe &</action>
551 </button>
552 "
553 elif [ "$pkg" = "gpxe" ]; then
554 tmp="$tmp
555 <text wrap=\"true\" use-markup=\"true\">
556 <label> \"<b>Boot URL:</b>\" </label>
557 </text>
558 <entry>
559 <default>$(dd if=$file bs=1 skip=519 count=255 2>/dev/null | strings)</default>
560 <variable>URL</variable>
561 </entry>
562 </hbox>
563 <hbox>
564 <button>
565 <input file icon=\"browser\"></input>
566 <label>Wiki</label>
567 <action>firefox http://wiki.slitaz.org/doku.php?id=quickstart:pxe &</action>
568 </button>
569 <button help>
570 <action type=\"launch\">HELP</action>
571 </button>
572 <button>
573 <label>Update</label>
574 <input file icon=\"reload\"></input>
575 <action>echo -n \"\$URL\" | cat - /dev/zero | dd conv=notrunc bs=1 count=255 seek=519 of=$file 2>/dev/null</action>
576 </button>
577 "
578 fi
579 receipt=/var/lib/tazpkg/installed/$pkg/receipt
580 if [ -f $receipt ]; then
581 . $receipt
582 tmp="$tmp
583 <button>
584 <input file icon=\"browser\"></input>
585 <label>Web</label>
586 <action>firefox $WEB_SITE &</action>
587 </button>
588 "
589 fi
590 tmp="$tmp
591 <button>
592 <label>Write floppy</label>
593 <input file icon=\"forward\"></input>
594 <action>bootfloppybox call install \"$pkg\" \"\$DEVICE\" \"$file\"</action>
595 </button>
596 </hbox>
597 </frame>
598 "
599 else
600 tmp2="tazpkg get-install $pkg --forced"
601 [ "$pkg" = "plop" ] && tmp2="bootfloppybox call get-plop $file"
602 tmp="$tmp
603 <text wrap=\"true\" width-chars=\"34\" use-markup=\"true\">
604 <label>
605 \"<i>The package <b>$pkg</b> is not yet installed</i>\"
606 </label>
607 </text>
608 <button>
609 <input file icon=\"go-jump\"></input>
610 <label>Install</label>
611 <action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
612 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title \"$pkg install\" -e \"$tmp2 ; sleep 2\"</action>
613 <action type=\"exit\">restart</action>
614 </button>
615 </hbox>
616 </frame>
617 "
618 fi
619 BOOT_DIALOG="$BOOT_DIALOG$tmp"
620 done <<EOT
621 SmartBtmgr /usr/share/boot/btmgr btmgr This OS independent Smart Boot Manager can boot any partition or ATAPI CD-ROM.
622 Plop /usr/share/boot/plpbt.bin plop This non free Boot Manager can boot a floppy disk, hardisk, USB or CD/DVD. Hit Ctrl-ESC for text mode.
623 Etherboot /usr/share/boot/etherboot etherboot This network bootloader provides a replacement for proprietary PXE or NBI ROMs.
624 gPXE /boot/gpxe gpxe PXE / iSCSI / AoE network bootloader.
625 Memtest86+ /usr/share/boot/memtest.lzma memtest Memory failures detection tool.
626 Grub4DOS /usr/share/boot/grldr.lzma grub4dos Enhanced grub version supporting NTFS.
627 Grub /usr/sbin/grub grub General purpose boot loader with command shell.
628 EOT
629 tmp='
630 </notebook>
631 <hbox>
632 <button>
633 <input file icon="media-cdrom"></input>
634 <label>Burn cdrom image</label>
635 <action>burnbox</action>
636 </button>
637 <button>
638 <input file icon="media-floppy"></input>
639 <label>Manage floppy image</label>
640 <action type="launch">FLOPPY_IMAGE</action>
641 </button>
642 <button>
643 <input file icon="exit"></input>
644 <label>Exit</label>
645 <action type="exit">Exit</action>
646 </button>
647 </hbox>
649 </vbox>
650 </window>
651 '
652 BOOT_DIALOG="$BOOT_DIALOG$tmp"
653 export BOOT_DIALOG
655 # Only root can create floppy.
656 check_root
657 gtkdialog --program=BOOT_DIALOG | grep -q 'EXIT="restart"' && continue
658 rm -f /tmp/floppybox.grub.menu
659 exit 0
660 done