wok-next view syslinux/stuff/iso2exe/init @ rev 19324
syslinux: adjust custom conf location
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Jul 14 10:28:07 2016 +0200 (2016-07-14) |
parents | 3432c28d8372 |
children | 2547fda51451 |
line source
1 #!/bin/sh
3 DIALOG=dialog
5 ddq()
6 {
7 dd $@ 2> /dev/null
8 }
10 get()
11 {
12 od -v -j $1 -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} -An $2 2>/dev/null ||
13 hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %d\n\"" $2
14 }
16 getarg()
17 {
18 sed "/$1=/!d;s/.*$1=\\([^ ]*\\).*/\\1/" /proc/cmdline
19 }
21 clear()
22 {
23 echo -e "\x1B[1;1H\x1B[J"
24 }
26 xless()
27 {
28 [ $(wc -l < "$1") -gt 22 ] &&
29 sed 's/..3.;4.m/===/g;$s/.*/&\n---\nPress q to continue/' "$1" | less ||
30 { cat "$1"
31 [ "$2" ] || return
32 echo -e "$2"
33 read n
34 }
35 }
37 tinydialog()
38 {
39 clear
40 label=""
41 while [ "$1" ]; do
42 case "$1" in
43 --title) title=" \x1B[30;47m$2\x1B[37;40m\n"
44 echo -e $title; shift ;;
45 --yes-label) label="$2" ; shift ;;
46 --textbox)
47 xless "$2" "\nPress RETURN to continue."
48 break;;
49 --gauge)
50 t=" "
51 echo -e "$t$2\n"
52 while read pct ; do
53 s=" "
54 s="$s$pct%$s"
55 pct=$((($pct*63)/100))
56 echo -en "\r$t\x1B[30;47m$(echo "$s" | cut -c-$pct)\x1B[37;40m$(echo "$s" | cut -c$(($pct+1))-)"
57 done
58 break;;
59 --yesno)
60 while true; do
61 clear
62 echo "$2" | sed 's/\\n\\n/\\n/g;s/\\n/\n/g'
63 echo -en " <- 1:${label:-Yes} 2:Cancel\r"
64 read x
65 case "$x" in
66 ''|Y*|y*|1) return 0;;
67 N*|n*|2|0) return 1;;
68 esac
69 done ;;
70 --menu|--radiolist)
71 [ "$1" == "--menu" ] && shft=2 || shft=3
72 label=""
73 [ "$2" ] && label="\n$2"
74 shift 5
75 echo -e "$title$label\n0 Cancel" > /tmp/data
76 n=1
77 while [ "$1" ]; do
78 eval key_$n='$1'
79 echo "$((n++)) $2"
80 shift $shft
81 done >> /tmp/data
82 while ! grep -q "^$n " /tmp/data ; do
83 clear
84 xless /tmp/data
85 echo -en "\n <- Enter the selection number\r"
86 read n
87 done 2> /dev/null
88 rm -f /tmp/data
89 [ $n -eq 0 ] && return 1
90 eval echo -n \$key_$n 1>&2
91 return 0;;
92 esac
93 shift
94 done
95 }
97 mount_proc()
98 {
99 mount -t proc /proc /proc
100 mount -t sysfs /sys /sys
101 udevd --daemon 2> /dev/null && udevadm trigger && sleep 5
102 }
104 umount_proc()
105 {
106 killall udevd 2> /dev/null
107 umount /sys/fs/fuse/connections 2> /dev/null
108 umount /sys
109 umount /proc
110 }
112 bytes2bin()
113 {
114 for i in $@ ; do
115 printf '\\\\x%02X' $(($i&255))
116 done | xargs echo -en
117 }
119 words2bin()
120 {
121 for i in $@ ; do
122 printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255))
123 done | xargs echo -en
124 }
126 gettazboot()
127 {
128 echo "Creating $(basename $1) ..."
129 O=$(($(get 64 /mnt/$ISO) - 0xC0))
130 L=$(($(get 20 /mnt/$ISO) - 0xC0 - $(get 24 /mnt/$ISO) - $O))
131 S=$((32+$L))
132 P=$((($S+511)/512))
133 E=$((4096-(32*$P)))
134 words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 $((${2:-0}-16)) \
135 -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1
136 ddq bs=1 count=$L skip=$(echo $O) if=/mnt/$ISO >> $1
137 }
139 checkmagic()
140 {
141 [ -s $1 ] && [ $(getarg magic) == $(get 24 $1 4) ]
142 }
144 getiso()
145 {
146 mkdir -p /media/cdrom
147 for dev in /sys/block/?d?/?d??* ; do
148 mount /dev/$(basename $dev) /mnt
149 if checkmagic /mnt/$ISO; then
150 mount -o loop,ro /mnt/$ISO /media/cdrom
151 echo "Found $ISO on $(basename $dev)"
152 break
153 fi
154 umount /mnt
155 done
156 }
158 uncpio()
159 {
160 [ -s "$1" ] || return
161 echo -en "\n Extracting $(basename $1) ..."
162 case $(get 0 $1) in
163 *35615) ( zcat || gunzip ) ;;
164 *14333) unxz ;;
165 *\ 93) unlzma ;;
166 *) cat ;;
167 esac < $1 | ( cd ${2:-/} ; cpio -idmu > /dev/null 2>&1 )
168 }
170 dotwait()
171 {
172 echo -n "${1:-Install filesystem}.."
173 touch /tmp/wait
174 while [ -e /tmp/wait ]; do
175 echo -n "." > /dev/tty0
176 sleep 1
177 done &
178 }
180 getuuid()
181 {
182 dev=$(mount | sed '/ \/mnt /!d;s/ .*//;s|/dev/||;q')
183 blkid | sed "/$dev:/!d;s/.* UUID=.\\([^ ]*\\)\".*/\\1/"
184 }
186 tazusbinitfs()
187 {
188 PAD=$(($(stat -c %s $1) % 4))
189 [ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1
190 mkdir -p /tmp/fs/etc /tmp/fs/lib /tmp/fs/home
191 cp -a /etc/locale.conf /tmp/fs/etc 2> /dev/null
192 cp -a /etc/keymap.conf /tmp/fs/etc 2> /dev/null
193 sed 's/ .*//' /proc/modules | while read mod ; do
194 find /lib/modules/ | grep $mod.ko | \
195 sed 's|.*|cp & /tmp/fs/lib|' | sh
196 done
197 cat > /tmp/fs/init1 <<EOT
198 #!/bin/sh
199 sed -i 's|sbin/init|init2|' /init
200 exec /init
201 EOT
202 cat > /tmp/fs/init2 <<EOT
203 #!/bin/sh
205 mount -t proc /proc /proc
206 grep -q debug /proc/cmdline && debug=true && set -x
207 for i in /lib/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
208 v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2> /dev/null)
209 mount / -o remount,rw
210 mkdir /mnt/dos
211 rm -f /cmdline 2> /dev/null
212 mount / -o remount,ro
213 mnt=/mnt/dos/\${v#*/}
214 dev=\$( (blkid /dev/[sh]d* || blkid) | grep \${v%%/*} | sed 's/:.*//;q')
215 echo "Mount \$dev in /mnt/dos for \$v..." | tee -a /run/boot.log
216 mount \$dev /mnt/dos
217 mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
218 mount --bind \$mnt /home
219 [ "\$debug" = "true" ] && sh
220 umount /proc
221 exec /sbin/init
222 EOT
223 chmod 755 /tmp/fs/init?
224 cp -a /tmp/fs/* /
225 ( cd /tmp/fs ; find * | cpio -o -H newc ) | gzip -9 >> $1
226 }
228 mkinitrd()
229 {
230 dotwait "Creating $(basename $1) "
231 for i in bin lib dev proc tmp mnt etc ; do
232 mkdir -p /tmp/fs/$i
233 done
234 for i in /dev/console /dev/null /dev/tty /dev/tty0 /dev/tty1 /dev/tty2 \
235 /dev/fuse /dev/hd* /dev/sd* ; do
236 cp -a $i /tmp/fs$i
237 done
238 for i in /bin/busybox $(which mount.posixovl) $(which blkid); do
239 cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $i | \
240 sed 's|.*=> \(.*/lib/l[^ ]*\).*|\1|;/^\//!d') /tmp/fs/lib
241 cp $i /tmp/fs/bin
242 done
243 cp -a /lib/ld-* /tmp/fs/lib
244 for i in $(busybox | sed '/Current/,$!d'); do
245 [ -e /tmp/fs/bin/${i%,} ] || ln -s busybox /tmp/fs/bin/${i%,}
246 done
247 ln -s /proc/mounts /tmp/fs/etc/mtab
248 sed 's/ .*//' /proc/modules | while read mod ; do
249 find /lib/modules/ | grep $mod.ko | \
250 sed 's|.*|cp & /tmp/fs/lib|' | sh
251 done
252 cat > /tmp/fs/init <<EOT
253 #!/bin/sh
255 arg()
256 {
257 grep -q \$1 /proc/cmdline &&
258 val="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" < /proc/cmdline)" &&
259 echo "\$2 \$val"
260 }
262 mount -t proc /proc /proc
263 arg debug "shell" && debug=true && set -x
264 for i in /lib/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
265 arg mount "Mount device"
266 mount \$( (blkid /dev/[sh]d* || blkid) | grep \$val | sed 's/:.*//;q') /mnt
267 arg subroot "Change root to directory"
268 mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
269 mount --bind /mnt /mnt/\$val/mnt/dos
270 mount -o size=0 -t tmpfs tmpfs /mnt/\$val/mnt/dos/\$val
271 LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
272 export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
273 [ "$debug" = "true" ] && sh
274 umount /proc
275 exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init
276 EOT
277 chmod +x /tmp/fs/init
278 ( cd /tmp/fs ; find * | cpio -o -H newc ) | lzma e $1 -si 2> /dev/null
279 rm -rf /tmp/fs /tmp/wait
280 }
282 is_loram()
283 {
284 [ -s /lib/squashfs.ko* ]
285 }
287 ls_r()
288 {
289 ls -r $@ 2> /dev/null || ls $@
290 }
292 doinstall()
293 {
294 mkdir -p /mnt/slitaz/boot /mnt/slitaz/mnt/dos
295 if ! mount.posixovl -F /mnt/slitaz -- \
296 -oallow_other -odefault_permissions -osuid; then
297 echo "Can't install SliTaz. Abort."
298 sleep 5
299 return 1
300 fi
301 dotwait "Install root filesystem in /slitaz.."
302 if [ "$1" ]; then
303 if [ -d /media/cdrom/fs ]; then
304 ( cd /mnt/slitaz/fs; find | cpio -o -H newc ) | gzip -9
305 else
306 ls_r /media/cdrom/boot/rootfs*gz | xargs cat
307 fi > /mnt/slitaz/boot/rootfs.gz
308 tazusbinitfs /mnt/slitaz/boot/rootfs.gz
309 initrd=rootfs.gz
310 extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
311 else
312 if [ -d /media/cdrom/fs ]; then
313 cp -a /media/cdrom/fs/. /mnt/slitaz
314 elif is_loram ; then
315 for i in /media/cdrom/boot/rootfs?*.* ; do
316 [ -s $(basename $i) ] && continue
317 cpio -i $i
318 done
319 for i in $(ls_r /media/cdrom/boot/rootfs*gz); do
320 mount -o loop,ro $i /sqfs/mnt
321 cp -a /sqfs/mnt/. /mnt/slitaz
322 umount -d /sqfs/mnt
323 done
324 else
325 for i in $(ls_r /media/cdrom/boot/rootfs*gz); do
326 uncpio $i /mnt/slitaz
327 done
328 fi
329 cp -a /etc/locale.conf /mnt/slitaz/etc 2> /dev/null
330 cp -a /etc/keymap.conf /mnt/slitaz/etc 2> /dev/null
331 mkinitrd /mnt/slitaz/boot/initrd
332 initrd=initrd
333 extraargs="mount=$(getuuid) subroot=slitaz"
334 fi
335 echo -en "\nInstall boot files..."
336 for i in /media/cdrom/boot/bzImage /media/cdrom/boot/*pxe* \
337 /media/cdrom/boot/isolinux/he* /media/cdrom/boot/isolinux/opt* \
338 /media/cdrom/README /media/cdrom/boot/memtest* ; do
339 [ -s $i ] && cp $i /mnt/slitaz/boot
340 done
341 for i in /mnt/slitaz/boot/memtest /mnt/slitaz/boot/*pxe* ; do
342 [ $(get 0 $i 2> /dev/null || echo 0) -eq 23117 ] &&
343 mv $i $i.exe
344 done
345 gettazboot /mnt/slitaz/boot/tazboot.exe
346 unix2dos > /mnt/slitaz/boot/tazboot.cmd <<EOT
347 kernel=/slitaz/boot/bzimage
348 initrd=/slitaz/boot/$initrd
349 rw root=/dev/null $extraargs autologin
350 EOT
351 unix2dos /mnt/slitaz/boot/he* /mnt/slitaz/boot/opt* \
352 /mnt/slitaz/boot/README
353 [ -d /mnt/slitaz/usr/sbin -a ! -x /mnt/slitaz/usr/sbin/mount.posixovl ] &&
354 cp $(which mount.posixovl) /mnt/slitaz/usr/sbin
355 rm -f /tmp/wait
356 false &&
357 [ -s /mnt/boot.ini ] && ! grep -qs tazboot /mnt/boot.ini &&
358 echo "Update boot.ini ..." && unix2dos >> /mnt/boot.ini <<EOT
359 C:\\slitaz\\boot\\tazboot.exe="SliTaz"
360 EOT
361 false &&
362 grep -qis menuitem /mnt/config.sys && ! grep -qi tazboot /mnt/config.sys &&
363 echo "Update config.sys ..." &&
364 sed -i 's/menudefault/menuitem SLITAZ, SliTaz\r\n&/' /mnt/config.sys &&
365 unix2dos >> /mnt/config.sys <<EOT
366 [SLITAZ]
367 install=\\slitaz\\boot\\tazboot.exe
368 EOT
369 return 0
370 }
372 install()
373 {
374 $DIALOG --clear \
375 --title " SliTaz UMSDOS way installation " \
376 --yes-label "Install" --yesno \
377 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
378 DOS/Windows partition. You will see your files from /mnt/dos.\n\n
379 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
380 To uninstall SliTaz, you have only to remove this directory.
381 The file \\boot.ini or \\config.sys may be modified too.\n\n
382 SliTaz may run slowly on 'UMSDOS way' installation due to the
383 posixovl filesystem. The 'TAZUSB way' installation runs faster.\n\n
384 To do a traditional installation with disk partitioning,
385 start SliTaz Live with 'SliTaz RAM boot' menu.\n
386 " 19 70
387 [ $? -eq 0 ] || return
388 doinstall || return
389 [ -x /mnt/slitaz/sbin/init ] || return
390 umount -d /media/cdrom
391 umount_proc
392 exec chroot /mnt/slitaz /sbin/init
393 }
395 installtaz()
396 {
397 $DIALOG --clear \
398 --title " SliTaz TAZUSB way installation " \
399 --yes-label "Install" --yesno \
400 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
401 DOS/Windows partition. You will see your files from /mnt/dos.\n\n
402 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
403 To uninstall SliTaz, you have only to remove this directory.
404 The file \\boot.ini or \\config.sys may be modified too.\n\n
405 The filesystem is loaded entirely into memory upon boot to
406 increase responsiveness. Only /home lands on hard disk.\n\n
407 To do a traditional installation with disk partitioning,
408 start SliTaz Live with 'SliTaz RAM boot' menu.\n
409 " 19 70
410 [ $? -eq 0 ] || return
411 doinstall tazusblike || return
412 dotwait
413 if [ -d /media/cdrom/fs ]; then
414 cp -a /media/cdrom/fs/. /
415 else
416 for i in $(ls_r /media/cdrom/boot/rootfs*gz); do
417 uncpio $i
418 done
419 fi
420 cp /tmp/fs/etc/* /etc
421 echo "/home=$(getuuid)/slitaz" > /cmdline
422 rm -f /tmp/wait
423 [ -x /init1 ] || return
424 umount -d /media/cdrom
425 umount /mnt/slitaz
426 rm -f /dev/cdrom
427 umount /mnt
428 mkdir /mnt/dos
429 umount_proc
430 exec /init1
431 }
433 tazboot()
434 {
435 $DIALOG --clear \
436 --title " SliTaz bootloader for DOS " \
437 --yes-label "Install" --yesno \
438 "\nThe file TAZBOOT.EXE will be created in the top directory. It supports
439 any linux kernel, multiple initramfs, a kernel command line and
440 an ISO image file loopback (retrieves files from an ISO file).\n\n
441 Usage: tazboot.exe [[@commands]|[kernel=<bzimage>]
442 [initrd=<rootfs>[,<rootfs2>...]] [bootfrom=<isofile>] cmdline args ...]\n\n
443 Defaults: tazboot @tazboot.cmd or tazboot kernel=bzImage auto\n\n\
444 Examples for tazboot.cmd:\n\n\
445 bootfrom=\\isos\\slitaz-4.0.iso\n\
446 kernel=boot/bzImage\n\
447 initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz\n\
448 rw root=/dev/null autologin\n\n\
449 kernel=\\slitaz\\vmlinuz root=/dev/sda5 ro\n\n
450 Unlike GRUB4DOS, it doesn't require unfragmented ISO image files.\n
451 " 24 78
452 [ $? -eq 0 ] || return
453 gettazboot /mnt/tazboot.exe
454 }
456 md5()
457 {
458 dotwait "Checking files"
459 ( cd /media/cdrom ; ${1:-md5sum -c md5sum*} | sort ) > /tmp/data
460 rm -f /tmp/wait
461 $DIALOG --clear \
462 --title " Checked files " \
463 --textbox /tmp/data 24 78
464 rm -f /tmp/data
465 }
467 gotcdfile()
468 {
469 for i in "/media/cdrom/$1" "/media/cdrom/*/$1" \
470 "/media/cdrom/*/isolinux/$1" ; do
471 file=$(ls $i 2> /dev/null | sed q)
472 [ -s "$file" ] && break
473 done
474 }
476 sha()
477 {
478 gotcdfile "sha*sum*"
479 sha=$(basename $file)
480 md5 "${sha%sum*}sum -c ${file#/media/cdrom/}"
481 }
483 readme()
484 {
485 gotcdfile "README*"
486 $DIALOG --clear \
487 --title " Readme " \
488 --textbox $file 24 78
489 }
491 bootlog()
492 {
493 $DIALOG --clear \
494 --title " Linux boot messages " \
495 --textbox /tmp/dmesg 24 78
496 }
498 bzimage()
499 {
500 $DIALOG --clear \
501 --title " Create linux.exe ? " \
502 --yes-label "Install" --yesno \
503 "\nLinux.exe launches the linux kernel under DOS (in real mode only).
504 The cmdline arguments are supported except initrd=,
505 vga= (you can try 'rdev -v') and mem= (partially).
506 \nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n
507 " 12 70
508 [ $? -eq 0 ] || return
509 cp /media/cdrom/boot/bzImage /mnt/linux.exe
510 }
512 memtest()
513 {
514 $DIALOG --clear \
515 --title " Create memtest.exe ? " \
516 --yes-label "Install" --yesno \
517 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
518 computers. BIOS based memory tests are a quick, cursory check and often
519 miss many of the failures that are detected by Memtest86.\n
520 " 12 70
521 [ $? -eq 0 ] && gotcdfile "memtest*" && cp $file /mnt/memtest.exe
522 }
524 mkfat12()
525 {
526 [ $(($(get 0 $1) - 0x5A4D)) -eq 0 ] || return
527 J=$(($(get 3 $1 1) + 0x02))
528 R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
529 [ $R -lt 2500 ] || return
530 [ $((($(get 500 $1)-1) & 31)) -lt 30 ] &&
531 ddq if=$file bs=32 count=1 seek=$(($R*16 - 1)) of=/dev/fd0
532 G="18 0 2 0 0 0 0 0"
533 [ $J -gt 25 ] || G=""
534 F=0
535 for i in 1 2 3; do
536 F=$((((2880-$R-$F-$F)*3+1023)/1024))
537 done
538 bytes2bin 0xEB $J 0x90 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 \
539 0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \
540 $G | ddq bs=1 of=/dev/fd0
541 ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0
542 for i in $R $(($R+$F)) ; do
543 bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
544 done
545 echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
546 }
548 mkfloppy()
549 {
550 dotwait "Create a $(basename $1) boot floppy"
551 ddq if=$1 of=/dev/fd0
552 mkfat12 $1
553 rm -f /tmp/wait
554 }
556 fdmemtest()
557 {
558 $DIALOG --clear \
559 --title " Create a Memtest86 boot floppy " \
560 --yes-label "Create floppy" --yesno \
561 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
562 computers. BIOS based memory tests are a quick, cursory check and often
563 miss many of the failures that are detected by Memtest86.\n\n
564 Please insert a blank disk in floppy drive.\n
565 " 12 70
566 [ $? -eq 0 ] && gotcdfile "memtest*" && mkfloppy $file
567 }
569 pxe()
570 {
571 gotcdfile "?pxe"
572 $DIALOG --clear \
573 --title " Create $(basename $file).exe ? " \
574 --yes-label "Install" --yesno \
575 "\nBoot your operating system from the internet and enjoy a full system
576 working entirely in RAM with speed and stability in mind. The Linux Kernel
577 and the complete SliTaz compressed root filesystem will be loaded into RAM
578 from the Web using PXE and HTTP protocols.\n
579 " 12 70
580 [ $? -eq 0 ] || return
581 cp $file /mnt/$(basename $file).exe
582 }
584 fdpxe()
585 {
586 $DIALOG --clear \
587 --title " Create a SliTaz Web boot floppy " \
588 --yes-label "Create floppy" --yesno \
589 "\nBoot your operating system from the internet and enjoy a full system
590 working entirely in RAM with speed and stability in mind. The Linux Kernel
591 and the complete SliTaz compressed root filesystem will be loaded into RAM
592 from the Web using PXE and HTTP protocols.\n\n
593 Please insert a blank disk in floppy drive.\n
594 " 12 70
595 [ $? -eq 0 ] && gotcdfile "?pxe" && mkfloppy $file
596 }
598 gotposixovl()
599 {
600 mount.posixovl 2>&1 | grep -qi usage &&
601 echo -en "\"$1\" \"$2\""
602 }
604 xfile()
605 {
606 [ "$(which $1)" ] && echo -en "\"$2\" \"$3\""
607 }
609 cdfile()
610 {
611 gotcdfile "$1" && echo -en "\"$2\" \"$3\""
612 }
614 isbzImage()
615 {
616 [ $(get 514 $file 4) -eq 1400005704 ] &&
617 [ $(($(get 529 $file 1) & 1)) -eq 1 ]
618 }
620 cdfilex()
621 {
622 gotcdfile "$1" &&
623 [ "$(which kexec)" ] &&
624 isbzImage &&
625 echo -en "\"$2\" \"$3\""
626 }
628 cdfilef()
629 {
630 [ -e /sys/block/fd0 ] && cdfile "$@"
631 }
633 cdexe()
634 {
635 gotcdfile "$1" &&
636 [ $(get 0 $file 2>/dev/null || echo 0) -eq 23117 ] &&
637 echo -en "\"$2\" \"$3\""
638 }
640 fddata()
641 {
642 [ -e /sys/block/fd0 ] &&
643 [ $(get 26 /mnt/$ISO 1 2> /dev/null || echo 0) -ne 0 ] &&
644 echo -en "\"$1\" \"$2\""
645 }
647 ishybrid()
648 {
649 [ $(get 510 $ISO) -eq 43605 ] || return
650 C=$((2048*$(get $(((17*2048) + 71)) /mnt/$ISO 4)))
651 [ $(get $C /mnt/$ISO 4) -eq 1 ] || return
652 [ $(get $(($C+30)) /mnt/$ISO 4) -eq $((0x88AA55)) ] || return
653 C=$((2048*$(get $(($C+40)) /mnt/$ISO 4)))
654 [ $(get $(($C+64)) /mnt/$ISO 4) -eq 1886961915 ] &&
655 echo -en "\"$1\" \"$2\""
656 }
658 burnable()
659 {
660 [ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info)" ] &&
661 [ "$(which wodim)" ] && echo -en "\"$1\" \"$2\""
662 }
664 blankable()
665 {
666 [ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info)" ] &&
667 [ "$(which wodim)" ] && echo -en "\"$1\" \"$2\""
668 }
670 burniso()
671 {
672 wodim -v speed=$(fgrep "drive speed" /proc/sys/dev/cdrom/info | cut -f3) \
673 -eject -multi "$ISO"
674 }
676 blankcd()
677 {
678 wodim -v -blank=fast
679 }
681 customsector()
682 {
683 echo $(get 32848 "/mnt/$ISO" 4)
684 }
686 hascustomconf()
687 {
688 [ "$(ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | ddq bs=1 count=6)" \
689 == "#!boot" ]
690 }
692 gotcustomconf()
693 {
694 hascustomconf && echo -en "\"$1\" \"$2\""
695 }
697 getcustomconf()
698 {
699 cd ${1:-/mnt}
700 ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | while read line; do
701 case "$line" in
702 \#!boot*) ;;
703 append=*) echo ${line#append=} > cmdline && ls -l cmdline ;;
704 initrd:*) cnt=${line#initrd:}
705 { ddq bs=512 count=$(($cnt / 512));
706 ddq bs=1 count=$(($cnt % 512)); } > initrd &&
707 ls -l initrd
708 break ;;
709 *) break ;;
710 esac
711 done
712 cd - > /dev/null
713 [ -z "$1" ] && echo -e "\rPress RETURN to continue." && read n
714 }
716 gotisomd5()
717 {
718 [ "$(which md5sum 2> /dev/null)" ] &&
719 [ $(get 0 /mnt/$ISO) -eq 23117 ] &&
720 [ $(get 18 /mnt/$ISO) -ne 0 ] && echo -en "\"$1\" \"$2\""
721 }
723 isomd5()
724 {
725 dotwait "Checking iso image"
726 [ "$(ddq if=/mnt/$ISO bs=2k skip=16 \
727 count=$(($(get 32848 /mnt/$ISO 4)-16)) | md5sum)" == \
728 "$(ddq if=/mnt/$ISO bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \
729 sed 's/ //g') -" ] && echo "OK" || echo "ERROR"
730 echo -en "\rChecking iso hybrid boot..."
731 n=$(($(get 2 /mnt/$ISO)-1+($(get 4 /mnt/$ISO)-1)*512))
732 if [ $n -lt 40000 -a $n -gt 32768 ]; then
733 s=$(get 0 /mnt/$ISO 2 $n | awk '{ i+= $0 } END { print i }')
734 [ $(((1+$s+$(get $(($n+1)) /mnt/$ISO 1)) % 65536)) -eq 0 ] &&
735 echo "OK" || echo "ERROR"
736 fi
737 if hascustomconf; then
738 echo -en "\rChecking iso custom config..."
739 TMP=/tmp/$(basename $0)$$md5
740 md5="$(ddq bs=2k skip=$(customsector) if=/mnt/$ISO | while read line; do
741 case "$line" in
742 \#!boot*) echo ${line#*boot } > $TMP ;;
743 append=*) echo $line ;;
744 initrd:*) echo $line
745 cnt=${line#initrd:}
746 ddq bs=512 count=$((cnt / 512))
747 ddq bs=1 count=$((cnt % 512))
748 break ;;
749 *) break ;;
750 esac
751 done | md5sum | cut -c1-32)"
752 [ "$md5" == "$(cat $TMP)" ] && echo "OK" || echo "ERROR"
753 rm -f $TMP
754 fi
755 rm -f /tmp/wait
756 echo -e "\rPress RETURN to continue."
757 read n
758 }
760 if [ "$1" == "--build" ]; then #install-begin
761 uuencode -m - < ifmem.bin | sed -e '/^ifmemcode$/r/dev/stdin' \
762 -e '/^ifmemcode$/d' -i $0
763 uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \
764 -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0
765 exit
766 fi #install-end
767 parse_isolinux()
768 {
769 awk 'BEGIN { IGNORECASE=1 }
770 function multi(n)
771 {
772 auto=$n
773 for (--n; n < NF; n+=2) {
774 s=$n
775 if (s ~ /M$/) s = substr(s,0,length(s)-1)
776 else s /= 1024
777 sizes=int(s) " " sizes
778 }
779 next
780 }
781 {
782 if ($1 == "LABEL") {
783 label=$2
784 if (auto == "") auto=label
785 }
786 if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2
787 if ($1 == "INITRD") initrd[label]=$2
788 if ($1 == "APPEND") {
789 i=2
790 if (kernel[label] ~ "ifmem.c32") multi(3)
791 if (kernel[label] ~ "c32box.c32") {
792 if ($2 == "linux") { kernel[label]=$3; i=4 }
793 if ($2 == "ifmem") multi(4)
794 }
795 if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next }
796 while (i <= NF) {
797 if ($i ~ "^initrd=") initrd[label]=substr($i,8)
798 else cmdline[label]=cmdline[label] " " $i
799 i++
800 }
801 }
802 }
803 END {
804 print "KERNEL=\"" kernel[auto] "\""
805 print "INITRD=\"" initrd[auto] "\""
806 print "CMDLINE=\"" substr(cmdline[auto],2) "\""
807 print "SIZES=\"" sizes "\""
808 }'
809 }
811 locase()
812 {
813 echo "$1" | tr [A-Z] [a-z]
814 }
816 ifmemcode()
817 {
818 uudecode <<EOT
819 ifmemcode
820 EOT
821 }
823 floppyset()
824 {
825 gotcdfile isolinux.cfg
826 parse_isolinux < $file > /tmp/var$$
827 . /tmp/var$$
828 for i in $media/$KERNEL $(dirname $file)/$KERNEL $media/$(locase $KERNEL) \
829 $(dirname $file)/$(locase $KERNEL); do
830 [ -s $i ] && KERNEL=$i && break
831 done
832 rm -f /tmp/var$$
833 [ $(get 514 $KERNEL 4) -eq 1400005704 ] || return
834 n=$(($(get 497 $KERNEL 1)+1))
835 ddq bs=512 count=$n if=$KERNEL of=/tmp/fd$$
836 uudecode <<EOT | ddq of=/tmp/fd$$ conv=notrunc
837 bootloader
838 EOT
839 pos=$(($n*512))
840 if [ -n "$CMDLINE" ]; then
841 echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$
842 bytes2bin $n | ddq conv=notrunc \
843 bs=1 seek=497 count=1 of=/tmp/fd$$
844 words2bin $pos | ddq conv=notrunc \
845 bs=1 seek=34 count=2 of=/tmp/fd$$
846 [ $(get 518 $KERNEL 4) -ge 514 ] &&
847 words2bin 32768 9 | ddq conv=notrunc \
848 bs=1 seek=552 count=4 of=/tmp/fd$$
849 fi
850 syssize=$(echo $(get 500 /tmp/fd$$ 4))
851 ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \
852 ddq bs=512 count=$((($syssize+31)/32)) conv=sync >> /tmp/fd$$
853 base=$(stat -c %s /tmp/fd$$)
854 len=
855 if [ "$INITRD" ]; then
856 l=0
857 for i in ${INITRD//,/ }; do
858 for j in $media/$i $(dirname $KERNEL)/$i $media/$(locase $i) \
859 $(dirname $KERNEL)/$(locase $i); do
860 [ -s $j ] && i=$j && break
861 done
862 ddq if=$i >> /tmp/fd$$
863 l=$(($l+$(stat -c %s $i)))
864 r=$((4 - ($l % 4)))
865 if [ $r -ne 4 ]; then
866 ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$
867 l=$(($l + $r))
868 fi
869 case "$i:$INITRD" in
870 *rootfs.gz:*rootfs.gz,*) continue # loram
871 esac
872 len="$len $l"; l=0
873 done
874 rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))}
875 words2bin $(($rdadrs & 0xFFFF)) $(($rdadrs >> 16)) | ddq \
876 conv=notrunc bs=1 seek=536 count=4 of=/tmp/fd$$
877 fi
878 n=$(echo $len | wc -w)
879 if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then
880 i=$(($(get 494 /tmp/fd$$)))
881 bytes2bin $(($i + ($n*4) - 256)) | ddq bs=1 conv=notrunc \
882 seek=496 count=1 of=/tmp/fd$$
883 else
884 i=$(($pos + 0x1FC - ($n*4)))
885 bytes2bin $(($i % 256)) $((i / 256)) 252 | ddq bs=1 \
886 conv=notrunc seek=494 count=3 of=/tmp/fd$$
887 s=$(($i - 2*$(echo "$SIZES" | wc -w)))
888 p=$(($s - $(ifmemcode | wc -c)))
889 ifmemcode | ddq bs=1 conv=notrunc seek=$p of=/tmp/fd$$
890 words2bin $SIZES | ddq bs=1 conv=notrunc seek=$s of=/tmp/fd$$
891 bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \
892 ddq bs=1 conv=notrunc seek=60 of=/tmp/fd$$
893 fi
894 for r in $len ; do
895 words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddq conv=notrunc \
896 bs=1 seek=$i count=4 of=/tmp/fd$$
897 i=$(($i + 4))
898 done
899 split -b 1440k /tmp/fd$$ fd$$
900 rm -f /tmp/fd$$
901 n=1; i=0; r=0
902 set -- $len
903 ls fd$$* | while read file ; do
904 if [ $i -gt $(($1+$base)) ]; then
905 shift
906 r=$(($r+100)); n=0; i=0; base=0
907 fi
908 ddq of=$file bs=18k seek=80 count=0
909 i=$(($i+1474560))
910 printf "mv %s fd%03d.img\n" $file $(($r+$n))
911 n=$(($n+1))
912 done | sh
913 ls fd???.img
914 }
916 fdbootstrap()
917 {
918 sz=$((512 * $(echo $(get 26 /mnt/$ISO 1))))
919 $DIALOG --clear \
920 --title " Create a floppy bootstrap " \
921 --yes-label "Continue" --yesno \
922 "\nThe floppy will install a driver to access the ISO file
923 on your hard disk and will emulate a CD-ROM during the boot process.\n\n
924 Please insert a floppy in drive now.\n
925 " 10 70
926 [ $? -eq 0 ] || return
927 ddq if=/mnt/$ISO of=/tmp/bootiso bs=1 count=512 \
928 skip=$(( $(get 64 /mnt/$ISO) - $sz ))
929 echo "$ISO" | ddq of=/tmp/bootiso bs=512 seek=1 count=1
930 ddq if=/mnt/$ISO of=/tmp/bootiso bs=1 count=$sz seek=2 \
931 skip=$(( $(get 64 /mnt/$ISO) - $sz + 512 ))
932 mkfloppy /tmp/bootiso
933 rm -f /tmp/bootiso
934 }
936 usbdev()
937 {
938 dotwait "Wait 5 seconds for USB devices"
939 sleep 5
940 rm -f /tmp/wait
941 DEV="$(grep -l 1 /sys/block/*/removable | \
942 sed 's|/sys/block/\(.*\)/removable|\1|')"
943 grep -qs 1 /sys/block/$DEV/ro && return
944 [ "$DEV" ] || return
945 cat > /tmp/dialog <<EOT
946 $DIALOG --clear \
947 --title " Select your USB key " \
948 --menu "\nPlease select the USB key according to its known size.\n\n" \
949 14 70 4 \
950 $(for i in $DEV ; do
951 echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2> /dev/null)\" "
952 done) \
954 EOT
955 exec 3>&1
956 device=$(. /tmp/dialog 2>&1 1>&3)
957 retval=$?
958 exec 3>&-
959 [ $retval -eq 0 ]
960 }
962 tazusbmsg()
963 {
964 [ "$(which tazusb 2> /dev/null)" ] || return
965 echo "You should choose 'USB key read/write installation' to be
966 able to save the package updates or your own configuration and data files.\n\n"
967 }
969 usbbootkey()
970 {
971 $DIALOG --clear \
972 --title " Create a USB boot key " \
973 --yes-label "Continue" --yesno \
974 "\nThe USB key will be used like a CD-ROM. You will not be able to write
975 any data on the boot partition.\n\n
976 An extra FAT32 partition will be created with the remaining free space.\n\n
977 $(tazusbmsg)Please plug your USB stick in now.\n
978 " 16 70
979 [ $? -eq 0 ] || return
980 usbdev || return
982 # perform dd in progress bar
983 max=$(($(cat /sys/block/loop0/size)/2048))
984 i=0; ddq if=/mnt/$ISO bs=1024k | (
985 while ddq bs=1024k count=1 ; do
986 i=$(($i + 1))
987 [ $i -gt $max ] && break
988 echo $((($i*100)/$max)) | dialog --gauge \
989 " The ISO image transfer can be long. Please wait..." \
990 6 70 0 > /dev/tty0 2>&1
991 done ) > $device
993 # partition + fat32 format for the remaining space
994 for p in 0 16; do
995 get $((450+$p)) $device 2 12 | xargs echo | {
996 read dx cx ol oh ll lh
997 [ $dx -eq $((0x3F17)) ] || continue
998 cx=$(($cx & 0xFF00))
999 ofs=$(($ll+($lh<<16)))
1000 n=$(($(cat /sys/block/${device#/dev/}/size)-$ofs))
1001 m=$(($cx+($n/8)))
1002 [ $m -gt $((0x3FF00)) ] && m=$((0x3FF00))
1003 m=$((($m & 0xFF00)+(($m>>16)<<6)))
1004 words2bin 0 $((0x101+$cx)) 0x3F0B $((32+$m)) \
1005 $ll $lh $(($n & 0xFFFF)) $(($n >> 16)) | \
1006 ddq bs=1 seek=$((462-$p)) of=$device
1007 if [ "$(which mkdosfs 2> /dev/null)" ]; then
1008 losetup -o $((512*$ofs)) /dev/loop2 $device
1009 mkdosfs -n "SLITAZ BOOT" /dev/loop2
1010 words2bin $(($ofs & 0xFFFF)) $(($ofs >> 16)) | \
1011 ddq bs=1 seek=28 of=/dev/loop2
1012 sync
1013 losetup -d /dev/loop2
1014 fi
1015 }
1016 done
1017 }
1019 usbkey()
1020 {
1021 $DIALOG --clear \
1022 --title " Create a SliTaz USB key " \
1023 --yes-label "Continue" --yesno \
1024 "\nUnlike a hard drive install, the filesystem is kept in a compressed
1025 rootfs.gz. The filesystem is loaded entirely into memory upon boot.
1026 This should increase responsiveness, protect the filesystem against
1027 accidental corruption and reduce read/writes to the USB drive.
1028 Once setup, the tazusb utility can rewrite the root filesystem
1029 with any changes you have made since booting up,
1030 giving the effective benefits of a hard drive install.\n\n
1031 /home is mounted on boot using the UUID of your particular flash drive.
1032 Unlike a device name, the UUID has the benefit of never changing from machine
1033 to machine.\n\n
1034 Please plug your USB stick in now.\n
1035 " 19 70
1036 [ $? -eq 0 ] || return
1037 usbdev || return
1038 exec 3>&1
1039 format=`$DIALOG --clear \
1040 --title " Select the filesystem " \
1041 --radiolist "\nPlease select the filesystem type to create.\n\n\
1042 The filesystem creation will erase all the data \
1043 in the USB key." 14 70 4 \
1044 "none" "Do not erase the USB key" on \
1045 "ext3" "Ext3 journaling filesystem" off \
1046 "ext2" "Ext2 filesystem" off \
1047 "fat32" "Windows FAT32 filesystem" off \
1048 2>&1 1>&3`
1049 retval=$?
1050 exec 3>&-
1051 [ $retval -eq 0 ] || return
1052 [ "$format" != "none" ] && tazusb format $device "SliTaz" $format
1053 tazusb gen-iso2usb /mnt/$ISO $device
1054 }
1056 mount_loram()
1057 {
1058 is_loram || return
1059 insmod /lib/squashfs.ko* 2> /dev/null
1060 if [ -d /media/cdrom/fs ]; then
1061 ln -s /media/cdrom/fs /sqfs
1062 else
1063 mkdir /sqfs
1064 mount -o loop,ro -t squashfs /rootfs*.gz /sqfs
1065 fi
1066 ln -s /sqfs/lib/* lib
1067 ln -s /sqfs/usr /sqfs/var /
1068 for i in dmesg basename tr od reboot poweroff getty sync ; do
1069 ln -s /sqfs/bin/busybox /bin/$i
1070 done
1071 }
1073 umount_loram()
1074 {
1075 is_loram || return
1076 rm /var /usr
1077 umount -d /sqfs
1078 rmdir /sqfs
1079 }
1081 dosync()
1082 {
1083 sync
1084 umount_loram
1085 umount -d /media/cdrom
1086 rm -f /dev/cdrom
1087 umount /mnt
1088 umount_proc
1089 }
1091 text()
1092 {
1093 init=
1094 cmdline="$(cat /proc/cmdline)"
1095 if hascustomconf; then
1096 getcustomconf /tmp > /dev/null
1097 [ -s /tmp/cmdline ] &&
1098 cmdline="$cmdline $(cat /tmp/cmdline)" &&
1099 init="$(sed '/rdinit=/!d;s/.*rdinit=\([^ ]*\).*/\1/' < /tmp/cmdline)"
1100 [ -s /tmp/initrd ] && uncpio /tmp/initrd
1101 fi
1102 dosync
1103 exec ${init:-/init} $cmdline
1104 }
1106 live()
1107 {
1108 n=0
1109 dotwait "Extract filesystem..."
1110 for i in $(ls_r /media/cdrom/boot/rootfs*gz); do
1111 grep -q ' lm ' /proc/cpuinfo && [ -s ${i}64 ] && i=${i}64
1112 [ $((n++)) -eq 0 ] || uncpio $i
1113 done
1114 rm -f /tmp/wait
1115 text
1116 }
1118 restart()
1119 {
1120 dosync
1121 reboot -f
1122 }
1124 stop()
1125 {
1126 dosync
1127 poweroff -f
1128 }
1130 dokexec()
1131 {
1132 kexec -l $file || return
1133 dosync
1134 kexec -e
1135 }
1137 runmemtest()
1138 {
1139 gotcdfile "memtest*" && dokexec
1140 }
1142 runpxe()
1143 {
1144 gotcdfile "?pxe" && dokexec
1145 }
1147 flavdata()
1148 {
1149 dd if=/mnt/$ISO bs=512 skip=$((1+$(get 417 /mnt/$ISO 1))) \
1150 count=20 2>/dev/null | zcat 2>/dev/null
1151 }
1153 hasflavinfo()
1154 {
1155 [ "$(flavdata | dd bs=1 count=8 2> /dev/null | strings)" == \
1156 "07070100" ] && echo -en "\"$1\" \"$2\""
1157 }
1159 showfavinfo()
1160 {
1161 mkdir -p /tmp/data
1162 flavdata | ( cd /tmp/data ; cpio -i )
1163 file=/tmp/data/info
1164 cat /tmp/data/*desc > $file
1165 for i in /tmp/data/*list* ; do
1166 echo "=== extra ${i#*list} files"
1167 cat $i
1168 done >> $file
1169 $DIALOG --clear \
1170 --title " Flavor info " \
1171 --textbox $file 24 78
1172 rm -rf /tmp/data
1173 }
1175 flavor()
1176 {
1177 cd /mnt
1178 name="$(flavdata | cpio -t 2> /dev/null | sed 's/.[a-z]*$//;q')"
1179 echo "Create ${name:=flavor}.flavor..."
1180 tazlito iso2flavor "/mnt/$ISO" $name
1181 ls -l $name.flavor 2> /dev/null || sleep 5
1182 cd - > /dev/null
1183 }
1185 shell()
1186 {
1187 trap text 2
1188 getty -n -l /bin/ash 38400 tty1 || sh
1189 }
1191 BIN=bin/mount.posixovl
1192 [ -x /usr/s$BIN ] || mv /bin/mount.posixovl.iso2exe \
1193 /usr/s$BIN 2> /dev/null || mv /bin/mount.posixovl.iso2exe /$BIN 2> /dev/null
1194 mount_proc
1195 for i in /sys/block/*/dev /sys/block/*/*/dev ; do
1196 [ -s "$i" ] || continue
1197 n=${i%/dev}
1198 n=/dev/${n##*/}
1199 [ -e $n ] && continue
1200 mknod $n b $(sed 's/:/ /' < $i)
1201 done
1202 ISO="$(getarg bootfrom | sed 's/.://;s|\\|/|g')"
1203 getiso
1204 mount_loram
1205 case "${ISO##*/}$(getarg mode)" in
1206 *install*|*INSTALL*) install ;;
1207 *live*|*LIVE*) live ;;
1208 *text*|*TEXT*) text ;;
1209 esac
1210 which $DIALOG 2> /dev/null || DIALOG=tinydialog
1211 dmesg > /tmp/dmesg
1213 isotitle="$(blkid /mnt/$ISO | sed 's/.*LABEL="\([^"]*\).*/\1/') $(stat \
1214 -c %y /media/cdrom | sed 's/ .*//') $(basename $ISO)"
1215 while true; do
1216 trap shell 2
1217 keymap="$(cat /etc/keymap.conf 2> /dev/null)"
1218 locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2> /dev/null)"
1219 cat > /tmp/dialog <<EOT
1220 $DIALOG --clear \
1221 --title " ${isotitle:-Welcome to Linux} " \
1222 --menu "" 23 70 17 \
1223 $(xfile tazkeymap "tazkeymap" "Select keyboard (${keymap:-none})") \
1224 $(xfile tazlocale "tazlocale" "Select locale (${locale:-none})") \
1225 $(cdfile boot/bzImage "live" "Linux RAM boot (full desktop)") \
1226 "text" "Linux RAM boot" \
1227 $(cdfile "README*" "readme" "Show the README file") \
1228 $(gotcustomconf "getcustomconf" "Get custom config") \
1229 $(gotisomd5 "isomd5" "Check the ISO image") \
1230 $(cdfile "md5sum*" "md5" "Check the ISO files") \
1231 $(cdfile "sha*sum*" "sha" "Check the ISO files") \
1232 $(burnable "burniso" "Burn the ISO image") \
1233 $(blankable "blankcd" "Blank the CD/DVD") \
1234 $(gotposixovl "install" "Hard disk installation (UMSDOS way)") \
1235 $(gotposixovl "installtaz" "Hard disk installation (TAZUSB way)") \
1236 $(xfile tazusb "usbkey" "USB key read/write installation") \
1237 $(ishybrid "usbbootkey" "USB boot key (read only)") \
1238 $(hasflavinfo "showfavinfo" "Show flavor extra info") \
1239 $(xfile tazlito "flavor" "Get flavor file") \
1240 $(fddata "fdbootstrap" "Create a floppy bootstrap") \
1241 $(cdfile isolinux.cfg "floppyset" "Boot floppy set") \
1242 "tazboot" "Get tazboot.exe Linux loader" \
1243 $(cdexe boot/bzImage "bzimage" "Get linux DOS/EXE file") \
1244 $(cdexe "memtest*" "memtest" "Get Memtest86 DOS/EXE file") \
1245 $(cdfilef "memtest*" "fdmemtest" "Create a Memtest86 boot floppy") \
1246 $(:||cdfilex "memtest*" "runmemtest" "Start Memtest86") \
1247 $(cdexe "?pxe" "pxe" "Get SliTaz Web boot DOS/EXE utility") \
1248 $(cdfilef "?pxe" "fdpxe" "Create a SliTaz Web boot floppy") \
1249 $(:||cdfilex "?pxe" "runpxe" "Start the SliTaz Web boot utility") \
1250 $(xfile reboot "restart" "Restart the computer") \
1251 $(xfile poweroff "stop" "Power off") \
1252 "bootlog" "Linux boot messages" \
1253 "shell" "Shell prompt" \
1255 EOT
1256 exec 3>&1
1257 value=$(. /tmp/dialog 2>&1 1>&3)
1258 retval=$?
1259 exec 3>&-
1260 [ $retval -eq 0 ] || continue
1261 $value
1262 done