wok view syslinux/stuff/iso2exe/init @ rev 21519

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