wok-current view syslinux/stuff/iso2exe/taziso @ rev 24164
linld: fix vcpi case
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Dec 26 17:19:46 2021 +0000 (2021-12-26) |
parents | 8eaf1d9eb640 |
children | 27c664d6b7a3 |
line source
1 #!/bin/sh
3 [ 0$(id -u 2>/dev/null) -eq 0 ] || exec su -c "$0 $@"
5 DIALOG=dialog
7 ddq()
8 {
9 dd $@ 2> /dev/null
10 }
12 ddn()
13 {
14 ddq conv=notrunc $@
15 }
17 get()
18 {
19 hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" "$2"
20 }
22 bytes2bin()
23 {
24 for i in $@ ; do
25 printf '\\\\x%02X' $(($i&255))
26 done | xargs echo -en
27 }
29 words2bin()
30 {
31 for i in $@ ; do
32 printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255))
33 done | xargs echo -en
34 }
36 quads2bin()
37 {
38 for i in $@ ; do
39 printf '\\\\x%02X\\\\x%02X\\\\x%02X\\\\x%02X' $(($i&255)) \
40 $((($i>>8)&255)) $((($i>>16)&255)) $((($i>>24)&255))
41 done | xargs echo -en
42 }
44 gettazboot()
45 {
46 echo -e "\nCreating $(basename $1) ..."
47 gotcdfile linld.com
48 S=$(($(stat -c %s $file)+12))
49 P=$((($S+511)/512))
50 E=$((4096-(32*$P)))
51 words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 -16 \
52 -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1
53 dd if=$file bs=1 count=$(($(stat -c %s $file)-1)) >> $1 2> /dev/null
54 echo -en '@tazboot.cmd\0' >> $1
55 }
57 maybe64()
58 {
59 echo -n $1
60 grep -q ' lm ' /proc/cpuinfo && [ -s ${1}64 ] && echo 64
61 }
63 size()
64 {
65 stat -c %s "$1"
66 }
68 sectcnt()
69 {
70 [ ! -b "$1" ] && echo $(($(size "$1")/512)) ||
71 cat /sys/block/${1#/dev/}/size
72 }
74 uncpio()
75 {
76 i=$1
77 [ $0 = /init.exe ] && i=$(maybe64 $i)
78 [ -s "$i" ] || return
79 echo -en "\n Extracting $(basename $i) ..."
80 case $(get 0 $i) in
81 *35615) ( zcat || gunzip ) ;;
82 *14333) unxz ;;
83 *\ 93) unlzma ;;
84 *) cat ;;
85 esac < $i | ( cd ${2:-/} ; cpio -idmu > /dev/null 2>&1 )
86 }
88 xdotwait=dotwait
89 dotwait()
90 {
91 echo -n "${1:-Install filesystem}.."
92 echo -n > /tmp/wait
93 [ "$REQUEST_URI" ] && return
94 while [ -e /tmp/wait ]; do
95 echo -n "." > /dev/${tty0:-tty}
96 sleep 1
97 done &
98 }
100 getuuid()
101 {
102 dev=$(mount | sed "/ $(echo $mnt | sed 's|/|\\/|g') /!d;s/ .*//;s|/dev/||;q")
103 [ "$dev" ] &&
104 blkid | sed "/$dev:/!d;s/.* UUID=.\\([^ ]*\\)\".*/\\1/" ||
105 echo "/dev/hda1"
106 }
108 tazusbinitfs()
109 {
110 PAD=$(($(size $1) % 4))
111 [ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1
112 mkdir -p /tmp/fs$$/etc /tmp/fs$$/lib /tmp/fs$$/home
113 cp -a /etc/locale.conf /etc/locale.conf /tmp/fs$$/etc 2> /dev/null
114 cat > /tmp/fs$$/init1 <<EOT
115 #!/bin/sh
116 sed -i 's|sbin/init|init2|' /init
117 exec /init
118 EOT
119 cat > /tmp/fs$$/init2 <<EOT
120 #!/bin/sh
122 mount -t proc /proc /proc
123 for i in /lib/modules/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
124 v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2> /dev/null)
125 mount / -o remount,rw
126 mkdir /mnt/dos
127 rm -f /cmdline 2> /dev/null
128 mount / -o remount,ro
129 mnt=/mnt/dos/\${v#*/}
130 dev=\$( (blkid /dev/[sh]d* || blkid) | grep \${v%%/*} | sed 's/:.*//;q')
131 echo "Mount \$dev in /mnt/dos for \$v..." | tee -a /run/boot.log
132 mount \$dev /mnt/dos
133 if [ ! -d /mnt/dos/slitaz ]; then
134 umount /mnt/dos 2> /dev/null
135 (blkid /dev/[sh]d* || blkid) | while read dev line; do
136 case "\$line" in
137 *ntfs*|*vfat*|*msdos*) ;;
138 *) continue ;;
139 esac
140 mount \${dev%:} /mnt/dos
141 [ -d /mnt/dos/slitaz ] && break
142 umount /mnt/dos
143 done
144 fi
145 $([ "$2" ] || echo '# ')mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
146 mount --bind \$mnt /home
147 mount -o size=0,ro -t tmpfs tmpfs \$mnt
148 umount /proc
149 exec /sbin/init
150 EOT
151 chmod 755 /tmp/fs$$/init?
152 ln -s /sqfs/bin/gzip /bin 2> /dev/null
153 ( cd /tmp/fs$$ ; find * | cpio -o -H newc ) | gzip -9 >> $1
154 rm -rf /tmp/fs$$
155 }
157 mkinitrd()
158 {
159 echo -en "\nCreating $(basename $1) "
160 fs=/tmp/fs$$
161 for i in bin lib dev proc tmp mnt etc ; do
162 mkdir -p $fs/$i
163 done
164 for i in /dev/null /dev/tty /dev/tty[012] /dev/fuse /dev/[hs]d* \
165 /dev/console ; do
166 cp -a $2$i $fs/dev/
167 done
168 for i in /bin/busybox $(which mount.posixovl) $(which blkid) \
169 $(which ntfs-3g); do
170 cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $i | \
171 sed 's|.*=> \(.*/lib/l[^ ]*\).*|\1|;/^\//!d') $fs/lib
172 cp $i $fs/bin
173 done
174 cp -a /sqfs/lib/ld-* /tmp/fs/lib 2> /dev/null ||
175 cp -a /lib/ld-* $fs/lib
176 for i in $(busybox | sed '/Current/,$!d'); do
177 [ -e $fs/bin/${i%,} ] || ln -s busybox $fs/bin/${i%,}
178 done
179 ln -s /proc/mounts $fs/etc/mtab
180 sed 's/ .*//' /proc/modules | while read mod ; do
181 find /lib/modules/ | grep $mod.ko | \
182 sed 's|.*|cp & $fs/lib|' | sh
183 done
184 cat > $fs/init <<EOT
185 #!/bin/sh
187 arg()
188 {
189 grep -q \$1 /proc/cmdline &&
190 val="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" < /proc/cmdline)" &&
191 echo "\$2 \$val"
192 }
194 mount -t proc /proc /proc
195 arg debug "shell" && debug=true && set -x
196 for i in /lib/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
197 arg mount "Mount device"
198 dsk=\$( (blkid /dev/[sh]d* || blkid) | grep \$val | sed 's/:.*//;q')
199 mount \$dsk /mnt || mount.ntfs \$dsk /mnt
200 arg subroot "Change root to directory"
201 if [ -d /mnt/\$val ]; then
202 umount /mnt 2> /dev/null
203 (blkid /dev/[sh]d* || blkid) | while read dev line; do
204 case "\$line" in
205 *ntfs*|*vfat*|*msdos*) ;;
206 *) continue ;;
207 esac
208 mount \${dev%:} /mnt
209 [ -d /mnt/\$val ] && break
210 umount /mnt
211 done
212 fi
214 $([ "$3" ] || echo -n '# ')mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
215 mount --bind /mnt /mnt/\$val/mnt/dos
216 mount -o size=0,ro -t tmpfs tmpfs /mnt/\$val/mnt/dos/\$val
217 LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
218 export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
219 [ "$debug" = "true" ] && sh
220 umount /proc
221 exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init
222 EOT
223 chmod +x $fs/init
224 ( cd $fs ; find * | cpio -o -H newc ) | lzma e $1 -si 2> /dev/null
225 rm -rf $fs /tmp/wait
226 }
228 ls_r()
229 {
230 ls -r $@ 2> /dev/null || ls $@
231 }
233 is_loram()
234 {
235 [ -s /lib/modules/squashfs.ko* ]
236 }
238 doinstall()
239 {
240 unset useposixovl
241 blkid | grep $(df $mnt | sed '$!d;s/ .*/:/') | \
242 grep -qiE "(msdos|vfat|ntfs)" && useposixovl=YES
243 case "$mnt" in
244 *mkzip*) useposixovl=YES
245 esac
246 mkdir -p $mnt/slitaz/boot $mnt/slitaz/mnt/dos
247 [ "$useposixovl" ] &&
248 if ! mount.posixovl -F $mnt/slitaz -- \
249 -oallow_other -odefault_permissions -osuid; then
250 echo "Can't install SliTaz. Abort."
251 sleep 5
252 return 1
253 fi
254 dotwait "Install root filesystem in /slitaz.."
255 if [ "$1" ]; then
256 ls_r $media/boot/rootfs*gz* | \
257 xargs cat > $mnt/slitaz/boot/rootfs.gz
258 tazusbinitfs $mnt/slitaz/boot/rootfs.gz $useposixovl
259 initrd=rootfs.gz
260 extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
261 else
262 if [ -d $media/fs ]; then
263 cp -a $media/fs/. $mnt/slitaz
264 elif is_loram; then
265 for i in $(ls_r $media/boot/rootfs*); do
266 losetup -o 124 /dev/loop7 $i
267 mount -t squashfs -o ro /dev/loop7 /sqfs/mnt
268 cp -a /sqfs/mnt/. $mnt/slitaz
269 umount /sqfs/mnt
270 losetup -d /dev/loop7
271 done
272 else
273 for i in $(ls_r $media/boot/rootfs*gz*); do
274 ${uncpio:-uncpio} $i $mnt/slitaz
275 done
276 fi
277 for i in $packages_list; do
278 tazpkg get-install $i --root=$mnt/slitaz
279 done
280 for i in $packages_dir/*.tazpkg; do
281 [ -s "$i" ] &&
282 tazpkg install $i --root=$mnt/slitaz
283 done
284 cp -a /etc/locale.conf $mnt/slitaz/etc 2> /dev/null
285 cp -a /etc/keymap.conf $mnt/slitaz/etc 2> /dev/null
286 mkinitrd $mnt/slitaz/boot/initrd $mnt/slitaz $useposixovl
287 initrd=initrd
288 extraargs="mount=$(getuuid) subroot=slitaz"
289 fi
290 echo -en "\nInstall boot files..."
291 for i in $media/boot/bzImage* $media/boot/*pxe* \
292 $media/boot/plop* \
293 $media/boot/isolinux/he* $media/boot/isolinux/opt* \
294 $media/README $media/boot/memtest* ; do
295 [ -s $i ] && cp $i $mnt/slitaz/boot
296 done
297 for i in $mnt/slitaz/boot/memtest $mnt/slitaz/boot/*pxe ; do
298 [ $(get 0 $i 2> /dev/null || echo 0) -eq 23117 ] &&
299 mv $i $i.exe
300 done
301 bzimage=$(cd $mnt/slitaz/boot ; ls bzImage* | sed q)
302 cp /etc/keymap.conf /etc/locale.conf $mnt/slitaz/etc 2> /dev/null
303 gettazboot $mnt/slitaz/boot/tazboot.exe # autoappend 64 suffix
304 unix2dos > $mnt/slitaz/boot/tazboot.cmd <<EOT
305 image=/slitaz/boot/$bzimage
306 initrd=/slitaz/boot/$initrd
307 root=/dev/null $extraargs autologin
308 EOT
309 uudecode - <<EOT | gunzip > $mnt/slitaz/boot/slitaz.pif
310 begin-base64 644 -
311 H4sIAAAAAAACA8XPxUHGMBTA8X9ecb/glgFwv+FO23zeI+7ucMFhCjZgEEZh
312 Ctzd4Rf3PFbtQHGLG9BmfmZqdlE/tSmw2LfePzOzWDK0OsQXpPHvFGfZBmL5
313 f3Zns98NuG1BbTrbWj0OFMypSKfT4kYCurKuRleWlBEth2qUTYFBKjg746pI
314 2nZaIT/v9vWwbeuqi9fPznLlSPFLLuK22/0lLT09/BDhXgWKO1f9aLKxOObE
315 EhLuVvO4FksSwaH5qbHpvkle0TyzND82NK+doRVeZgGGbIw0XD2QwV9SnAN/
316 ACxDxwMAAA==
317 ====
318 EOT
319 unix2dos $mnt/slitaz/boot/he* $mnt/slitaz/boot/opt* \
320 $mnt/slitaz/boot/README
321 [ -d $mnt/slitaz/usr/sbin -a ! -x $mnt/slitaz/usr/sbin/mount.posixovl ] &&
322 cp $(which mount.posixovl) $mnt/slitaz/usr/sbin
323 if [ "$useposixovl" ] && grep -qs " $mnt " /proc/mounts &&
324 [ ! -d $mnt/boot/grub ]; then
325 mkdir -p $mnt/boot/grub
326 echo -en "\nInstall grub in /boot/grub..."
327 cp -a /usr/lib/grub/*/* $mnt/boot/grub
328 cat > $mnt/boot/grub/menu.lst <<EOT
329 # /boot/grub/menu.lst: GRUB boot loader configuration.
331 # By default, boot the first entry.
332 default 0
334 # Boot automatically after 8 secs.
335 timeout 8
337 title Microsoft Windows
338 chainloader +1
340 EOT
341 dev=$(grep " $mnt " /proc/mounts | awk '{ print $1 }')
342 base=${dev//[0-9]/}
343 dd if=$base bs=32k count=1 of=$mnt/boot/grub/$(basename $base)
344 cat > $mnt/boot/grub/uninstall-grub.sh <<EOT
345 #!/bin/sh
347 [ -s /boot/grub/$(basename $base) ] &&
348 dd if=/boot/grub/$(basename $base) of=$base
349 EOT
350 grub-install --no-floppy --root-directory=$mnt $base
351 fi
352 if [ -s $mnt/boot/grub/menu.lst ] &&
353 ! grep -q /slitaz/boot/$bzimage $mnt/boot/grub/menu.lst; then
354 echo -en "\nUpdate /boot/grub/menu.lst..."
355 cat >> $mnt/boot/grub/menu.lst <<EOT
356 title SliTaz GNU/Linux $(cat $mnt/slitaz/etc/slitaz-release)
357 kernel /slitaz/boot/$bzimage root=/dev/null $extraargs autologin
358 initrd /slitaz/boot/$initrd
360 EOT
361 fi
362 false &&
363 [ -s $mnt/boot.ini ] && ! grep -qs tazboot $mnt/boot.ini &&
364 echo "Update boot.ini ..." && unix2dos >> $mnt/boot.ini <<EOT
365 C:\\slitaz\\boot\\tazboot.exe="SliTaz"
366 EOT
367 false &&
368 grep -qis menuitem $mnt/config.sys && ! grep -qi tazboot $mnt/config.sys &&
369 echo "Update config.sys ..." &&
370 sed -i 's/menudefault/menuitem SLITAZ, SliTaz\r\n&/' $mnt/config.sys &&
371 unix2dos >> $mnt/config.sys <<EOT
372 [SLITAZ]
373 install=\\slitaz\\boot\\tazboot.exe
374 EOT
375 rm -f $tmp/wait
376 [ "$useposixovl" ] && umount $mnt/slitaz
377 return 0
378 }
380 windev()
381 {
382 if [ -b "$1" ]; then
383 device=$1
384 elif [ "$1" ]; then
385 echo "Invalid Linux/Windows partition"
386 return 1
387 else
388 DEV="$(blkid | grep -iE "(msdos|vfat|ntfs|ext[234]|xfs|btrfs)" | sed 's/:.*//;s|/dev/||')"
389 [ "$DEV" ] || return
390 cat > /tmp/dialog$$ <<EOT
391 $DIALOG --clear --title " Select your Linux/Windows partition " \
392 --menu "\nPlease select the Linux/Windows partition according to its known size.
393 The data will be kept untouched.\n" 17 70 8 \
394 $(for i in $DEV ; do
395 label="$(blkid | sed "/$i:/!d;s/.*://;s/[^ ]*UUID=[^ ]* //g;s/LABEL=//")"
396 echo -n "/dev/$i \"$(($(cat /sys/block/*/$i/size)/2048))MB $label\" "
397 done)
398 EOT
399 exec 3>&1
400 [ $? -eq 0 ] || return
401 device=$(. /tmp/dialog$$ 2>&1 1>&3)
402 exec 3>&-
403 rm -f /tmp/dialog$$
404 fi
405 mnt=/tmp/mnt$$
406 mkdir -p $mnt && mount $device $mnt
407 }
409 extra_packages()
410 {
411 packages_list=
412 packages_dir=
413 [ $0 = /init.exe ] && return
414 $DIALOG --clear --title " Extra packages " \
415 --defaultno --yesno \
416 "Do you want to add extra packages ?" 7 70
417 [ $? -eq 0 ] || return
418 [ -s /var/lib/tazpkg/packages.txt ] || tazpkg recharge
419 if [ -s $media/boot/vmlinuz-$(uname -r) ]; then
420 cat > /tmp/dialog$$ <<EOT
421 $DIALOG --clear --title " Select the packages " \
422 --separate-output \
423 --cancel-label "Skip" \
424 --checklist "Please select the packages you want to install. Try with the first letter." \
425 0 0 0 \\
426 EOT
427 awk -F\| '{ printf "%s \"%s\" off ",$1,$3 }' \
428 /var/lib/tazpkg/packages.desc >> /tmp/dialog$$
429 sh /tmp/dialog$$ 2> /tmp/dialog.out$$
430 [ $? -eq 0 ] && packages_list="$(cat /tmp/dialog.out$$)"
431 fi
432 cat > /tmp/dialog$$ <<EOT
433 $DIALOG --clear \
434 --title "Please select the directory with every custom package to install." \
435 --cancel-label "Skip" --dselect $PWD 13 78
436 EOT
437 sh /tmp/dialog$$ 2> /tmp/dialog.out$$
438 [ $? -eq 0 ] && packages_dir="$(cat /tmp/dialog.out$$)"
439 rm -f /tmp/dialog$$ /tmp/dialog.out$$
440 }
442 _install()
443 {
444 extra_packages
445 $DIALOG --clear --title " SliTaz UMSDOS way installation " \
446 --yes-label "Install" --yesno \
447 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
448 Linux/DOS/Windows partition. You can see your files from /mnt/dos.\n\n
449 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
450 To uninstall SliTaz, you have only to remove this directory.
451 The file \\boot.ini or \\config.sys may be modified too.\n\n
452 SliTaz may run slowly on the 'UMSDOS way' installation due to the
453 posixovl filesystem. The 'TAZUSB way' installation runs faster.\n\n
454 To do a traditional installation with disk partitioning,
455 start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
456 [ $? -eq 0 ] || return
457 doinstall
458 [ $0 = /init.exe ] || return 0
459 [ -x $mnt/slitaz/sbin/init ] || return 0
460 umount -d $media/cdrom
461 umount_proc
462 exec chroot $mnt/slitaz /sbin/init
463 }
465 readtazbootconf()
466 {
467 kernel="$(sed '/^image=/!d;s/.*=//' $mnt/slitaz/boot/tazboot.cmd)"
468 initrd="$(sed '/^initrd=/!d;s/.*=//' $mnt/slitaz/boot/tazboot.cmd)"
469 cmdline="$(sed '/^image=/d;/^initrd=/d' $mnt/slitaz/boot/tazboot.cmd)"
470 }
472 bootinstalled()
473 {
474 [ "$(which kexec)" ] || return
475 [ -x $mnt/slitaz$1 ] || return
476 [ -s $mnt/slitaz/boot/tazboot.cmd ] || return
477 readtazbootconf
478 kexec -l $kernel --initrd $initrd --command-line "$cmdline" || return
479 umount $mnt
480 rm -rf $mnt
481 quit "kexec -e"
482 }
484 mkzip()
485 {
486 device=
487 packages_list=
488 packages_dir=
489 mnt=/tmp/mkzipmnt$$
490 mkdir -p $mnt
491 $1 $2 || return
492 for i in bootlace.com grubinst.exe grldr ; do
493 wget -O $mnt/slitaz/boot/$i http://mirror.slitaz.org/boot/$i
494 done
495 readtazbootconf
496 cat > $mnt/slitaz/boot/menu.lst <<EOT
497 title SliTaz
498 kernel $kernel $cmdline
499 initrd $initrd
501 EOT
502 while read file title; do
503 file=$(ls $mnt/slitaz/boot/*$file* 2> /dev/null)
504 [ -s "$file" ] && cat >> $mnt/slitaz/boot/menu.lst <<EOT
505 title $title
506 kernel ${file#$mnt}
508 EOT
509 done <<EOT
510 memtest MemTest
511 plop USB boot
512 pxe Web boot
513 EOT
514 unix2dos $mnt/slitaz/boot/menu.lst
515 unix2dos > $mnt/slitaz/boot/install.txt <<EOT
516 For DOS users (real mode only):
518 Start SliTaz with \\slitaz\\boot\\tazboot.exe
521 For NT/2000/XP users:
523 1- Move the files grldr and menu.lst into the root directory
525 C:\\> copy \\slitaz\\boot\\grldr \\
526 C:\\> copy \\slitaz\\boot\\menu.lst \\
528 2- Remove boot.ini attributes
530 C:\\> attrib -r -h -s boot.ini
532 3- Append the following line to boot.init
534 C:\\grldr="slitaz"
536 4- Restore boot.ini attributes
538 C:\\> attrib +r +h +s boot.ini
540 See http://diddy.boot-land.net/grub4dos/files/README_GRUB4DOS.txt
541 and http://xpt.sourceforge.net/techdocs/nix/disk/boot/boot07-GrubForDosInfo/ar01s03.html
542 EOT
543 ( cd $mnt ; echo 'See \slitaz\boot\install.txt to launch SliTaz.' | \
544 zip -zr9 $(basename "$ISO" .iso).zip slitaz )
545 [ "$(which advzip)" ] &&
546 echo "Recompressing $(basename "$ISO" .iso).zip ..." &&
547 advzip -z4 $mnt/*.zip
548 mv $mnt/*.zip .
549 du -h $PWD/$(basename "$ISO" .iso).zip
550 umount $mnt
551 rm -rf $mnt
552 }
554 install()
555 {
556 windev $1 || return
557 packages_list=
558 packages_dir=
559 if [ "$1" ]; then
560 doinstall
561 else
562 _install && bootinstalled /sbin/init
563 fi
564 umount $mnt
565 rm -rf $mnt
566 }
568 inst2zip()
569 {
570 if [ "$1" ]; then
571 mkzip doinstall
572 else
573 mkzip _install
574 fi
575 }
577 _installtaz()
578 {
579 $DIALOG --clear --title " SliTaz TAZUSB way installation " \
580 --yes-label "Install" --yesno \
581 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
582 Linux/DOS/Windows partition. You can see your files from /mnt/dos.\n\n
583 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
584 To uninstall SliTaz, you have only to remove this directory.
585 The file \\boot.ini or \\config.sys may be modified too.\n\n
586 The filesystem is loaded entirely into memory upon boot to
587 increase responsiveness. Only /home lands on the hard disk.\n\n
588 To do a traditional installation with disk partitioning,
589 start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
590 [ $? -eq 0 ] || return
591 doinstall tazusblike || return
592 [ $0 = /init.exe ] || return
593 dotwait
594 if [ -d /media/cdrom/fs ]; then
595 cp -a /media/cdrom/fs/. /
596 else
597 for i in $(ls_r /media/cdrom/boot/rootfs*); do
598 ${uncpio:-uncipo} $i
599 done
600 fi
601 cp /tmp/fs/etc/* /etc 2>/dev/null
602 echo "/home=$(getuuid)/slitaz" > /cmdline
603 rm -f /tmp/wait
604 [ -x /init1 ] || return
605 umount -d /media/cdrom
606 umount /mnt/slitaz
607 rm -f /dev/cdrom
608 umount /mnt
609 mkdir /mnt/dos
610 umount_proc
611 exec /init1
612 }
614 installtaz()
615 {
616 windev $1 || return
617 packages_list=
618 packages_dir=
619 if [ "$1" ]; then
620 doinstall tazusblike
621 else
622 _installtaz && bootinstalled /boot/bzImage
623 fi
624 umount $mnt
625 rm -rf $mnt
626 }
628 insttaz2zip()
629 {
630 if [ "$1" ]; then
631 mkzip doinstall tazusblike
632 else
633 mkzip _installtaz
634 fi
635 }
637 bootiso()
638 {
639 cd /tmp
640 for i in $(ls_r $media/boot/rootfs*gz); do
641 i=$(maybe64 $i)
642 cat $i
643 n=$((4 - ($(size $i) % 4)))
644 [ $n -eq 4 ] || dd if=/dev/zero bs=1 count=$n
645 done > initrd$$
646 cmdline="root=/dev/null autologin lang=$LANG"
647 [ -s /etc/keymap.conf ] && cmdline="$cmdline kmap=$(cat /etc/keymap.conf)"
648 [ -s /etc/TZ ] && cmdline="$cmdline tz=$(cat /etc/TZ)"
649 rm -f cmdline initrd 2> /dev/null
650 getcustomconf kexec >/dev/null
651 [ -s cmdline ] && cmdline="$cmdline $(cat cmdline)" && rm cmdline
652 [ -s initrd ] && cat initrd >> initrd$$ && rm initrd
653 kernel=$(maybe64 $media/boot/bzImage)
654 . /etc/locale.conf
655 kexec -l $kernel --initrd initrd$$ --command-line "$cmdline" &&
656 rm -f initrd$$
657 quit "kexec -e"
658 }
660 tazboot()
661 {
662 if [ -z "$1" ]; then
663 $DIALOG --clear --title " SliTaz bootloader for DOS " \
664 --yes-label "Install" --yesno \
665 "\nThe file TAZBOOT.EXE will be created in the top directory. It supports
666 any linux kernel, multiple initramfs and a kernel command line.\n\n
667 Usage: tazboot.exe [[@commands]|[image=<bzimage>]
668 [initrd=<rootfs>[,<rootfs2>...]] cmdline args ...]\n\n
669 Defaults: tazboot @tazboot.cmd or tazboot image=bzImage auto\n\n\
670 Examples for tazboot.cmd:\n\n\
671 image=boot/bzImage\n\
672 initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz\n\
673 root=/dev/null autologin\n\n\
674 image=\\slitaz\\vmlinuz root=/dev/sda5 ro\n" 0 0
675 [ $? -eq 0 ] || return
676 fi
677 gettazboot tazboot.exe
678 du -h $PWD/tazboot.exe
679 }
681 md5()
682 {
683 dotwait "Checking files"
684 ( cd $media ; ${md5sum:-md5sum -c md5sum*} 2>&1 | sort ) > /tmp/data
685 unset md5sum
686 rm -f /tmp/wait
687 if [ "$1" ]; then
688 cat /tmp/data
689 else
690 $DIALOG --clear --title " Checked files " \
691 --textbox /tmp/data 0 0
692 fi
693 rm -f /tmp/data
694 }
696 filepos()
697 {
698 dotwait "locate files"
699 ( cd $media; find * -type f | while read f; do
700 printf "%8d %s\n" $(stat -m "$f" | sed q) "$f"
701 done | sort -n ) > /tmp/data
702 rm -f /tmp/wait
703 if [ "$1" ]; then
704 cat /tmp/data
705 else
706 $DIALOG --clear --title " File start sector " \
707 --textbox /tmp/data 0 0
708 fi
709 rm -f /tmp/data
710 }
712 gotcdfile()
713 {
714 for i in "$media/$1" "$media/*/$1" "$media/*/isolinux/$1" ; do
715 file=$(ls $i 2> /dev/null | sed q)
716 [ -s "$file" ] && break
717 done
718 }
720 sha()
721 {
722 gotcdfile 'sha*sum*'
723 sha=$(basename $file)
724 md5sum="${sha%sum*}sum -c ${file#$media/}"
725 md5 $@
726 }
728 readme()
729 {
730 gotcdfile 'README*'
731 if [ "$1" ]; then
732 cat $file
733 else
734 $DIALOG --clear --title " Readme " --textbox $file 0 0
735 fi
736 }
738 bzimage()
739 {
740 if [ -z "$1" ]; then
741 $DIALOG --clear --title " Create linux.exe ? " \
742 --yes-label "Install" --yesno \
743 "\nLinux.exe launches the linux kernel under DOS (in real mode only).
744 The cmdline arguments are supported except initrd=,
745 vga= (you can try 'rdev -v') and mem= (partially).
746 \nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n" 12 70
747 [ $? -eq 0 ] || return
748 fi
749 cp $(maybe64 $media/boot/bzImage) linux.exe
750 du -h $PWD/linux.exe
751 }
753 memtest()
754 {
755 if [ -z "$1" ]; then
756 $DIALOG --clear --title " Create memtest.exe ? " \
757 --yes-label "Install" --yesno \
758 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
759 computers. BIOS based memory tests are a quick, cursory check and often
760 miss many of the failures that are detected by Memtest86.\n" 0 0
761 [ $? -eq 0 ] || return
762 fi
763 gotcdfile 'memtest*' && cp $file memtest.exe
764 du -h $PWD/memtest.exe
765 }
767 mkfat12()
768 {
769 [ $(($(get 0 $1) - 0x5A4D)) -eq 0 ] || return
770 J=$(($(get 3 $1 1) + 0x02))
771 R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
772 [ $R -lt 2500 ] || return
773 [ $((($(get 500 $1)-1) & 31)) -lt 30 ] &&
774 ddq if=$file bs=32 count=1 seek=$(($R*16 - 1)) of=/dev/fd0
775 G="18 0 2 0 0 0 0 0"
776 [ $J -gt 25 ] || G=""
777 F=0
778 for i in 1 2 3; do
779 F=$((((2880-$R-$F-$F)*3+1023)/1024))
780 done
781 bytes2bin 0xEB $J 0x90 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 \
782 0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \
783 $G | ddq bs=1 of=/dev/fd0
784 ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0
785 for i in $R $(($R+$F)) ; do
786 bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
787 done
788 echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
789 }
791 mkfloppy()
792 {
793 dotwait "Create a $(basename $1 .exe) boot floppy"
794 ddq if=$1 of=/dev/fd0
795 mkfat12 $1
796 rm -f /tmp/wait
797 }
799 fdmemtest()
800 {
801 if [ -z "$1" ]; then
802 $DIALOG --clear --title " Create a Memtest86 boot floppy " \
803 --yes-label "Create floppy" --yesno \
804 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
805 computers. BIOS based memory tests are a quick, cursory check and often
806 miss many of the failures that are detected by Memtest86.\n\n
807 Please insert a blank disk in floppy drive.\n" 0 0
808 [ $? -eq 0 ] || return
809 fi
810 gotcdfile 'memtest*' && mkfloppy $file
811 }
813 pxe()
814 {
815 gotcdfile '?pxe*'
816 if [ -z "$1" ]; then
817 $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
818 --yes-label "Install" --yesno \
819 "\nBoot your operating system from the internet and enjoy a full system
820 working entirely in RAM with speed and stability in mind. The Linux Kernel
821 and the complete SliTaz compressed root filesystem will be loaded into RAM
822 from the Web using PXE and HTTP protocols.\n" 0 0
823 [ $? -eq 0 ] || return
824 fi
825 cp $file $(basename $file .exe).exe
826 du -h $PWD/$(basename $file .exe).exe
827 }
829 fdpxe()
830 {
831 if [ -z "$1" ]; then
832 $DIALOG --clear --title " Create a SliTaz Web boot floppy " \
833 --yes-label "Create floppy" --yesno \
834 "\nBoot your operating system from the internet and enjoy a full system
835 working entirely in RAM with speed and stability in mind. The Linux Kernel
836 and the complete SliTaz compressed root filesystem will be loaded into RAM
837 from the Web using PXE and HTTP protocols.\n\n
838 Please insert a blank disk in floppy drive.\n" 0 0
839 [ $? -eq 0 ] || return
840 fi
841 gotcdfile '?pxe*' && mkfloppy $file
842 }
844 plop()
845 {
846 gotcdfile 'plop*'
847 if [ -z "$1" ]; then
848 $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
849 --yes-label "Install" --yesno \
850 "\nBoot your operating system from a USB disk without BIOS support.\n" 0 0
851 [ $? -eq 0 ] || return
852 fi
853 cp $file $(basename $file .exe).exe
854 du -h $PWD/$(basename $file .exe).exe
855 }
857 fdplop()
858 {
859 if [ -z "$1" ]; then
860 $DIALOG --clear --title " Create a Plop boot floppy " \
861 --yes-label "Create floppy" --yesno \
862 "\nBoot your operating system from a USB disk without BIOS support.\n\n
863 Please insert a blank disk in floppy drive.\n" 0 0
864 [ $? -eq 0 ] || return
865 fi
866 gotcdfile 'plop*' && mkfloppy $file
867 }
869 menuitem()
870 {
871 [ "$3" ] && shift
872 echo -en "\"$1\" \"$2\""
873 }
875 gotposixovl()
876 {
877 mount.posixovl 2>&1 | grep -qi usage && gotcdfile 'rootfs*.gz' &&
878 menuitem "$@"
879 }
881 gotposixovlzip()
882 {
883 [ "$(which zip)" ] && gotposixovl "$1" "$2"
884 }
886 noinit()
887 {
888 [ $0 = /init.exe ] || menuitem "$@"
889 }
891 initx()
892 {
893 [ $0 = /init.exe ] && menuitem "$@"
894 }
896 xfile()
897 {
898 for i in $1; do
899 [ "$(which $i)" ] && menuitem "$@" && break
900 done
901 }
903 initxfile()
904 {
905 [ $0 = /init.exe ] && xfile "$@"
906 }
908 cdfile()
909 {
910 gotcdfile "$1" && menuitem "$@"
911 }
913 gottazusb()
914 {
915 gotcdfile 'rootfs*.gz' && xfile tazusb "$@"
916 }
918 isbzImage()
919 {
920 [ $(get 514 $file 4) -eq 1400005704 ] &&
921 [ $(($(get 529 $file 1) & 1)) -eq 1 ]
922 }
924 cdfilex()
925 {
926 gotcdfile "$1" && [ "$(which kexec)" ] && isbzImage && menuitem "$@"
927 }
929 cdfilef()
930 {
931 [ -e /sys/block/fd0 ] && cdfile "$@"
932 }
934 cdexe()
935 {
936 gotcdfile "$1" &&
937 [ $(get 0 $file 2>/dev/null || echo 0) -eq 23117 ] &&
938 [ $(get 128 $file 2>/dev/null || echo 0) -ne 10 ] &&
939 menuitem "$@"
940 }
942 misspkg()
943 {
944 for i in zip kexec-tools posixovl cdrkit cdrkit-isoinfo ; do
945 [ -d /var/lib/tazpkg/installed/$i/ ] && continue
946 [ "$1" != "install" ] && menuitem "$@" && return
947 tazpkg get-install $i
948 done
949 }
951 noinitmisspkg()
952 {
953 [ $0 = /init.exe ] || misspkg "$@"
954 }
956 missing()
957 {
958 misspkg install
959 }
961 ishybrid()
962 {
963 [ $(get 510 "$ISO") -eq 43605 ] || return
964 C=$((2048*$(get $(((17*2048) + 71)) "$ISO" 4)))
965 [ $(get $C "$ISO" 4) -eq 1 ] || return
966 [ $(get $(($C+30)) "$ISO" 4) -eq $((0x88AA55)) ] || return
967 C=$((2048*$(get $(($C+40)) "$ISO" 4)))
968 [ $(get $(($C+64)) "$ISO" 4) -eq 1886961915 ] && menuitem "$@"
969 }
971 isiso()
972 {
973 [ $(get 32769 "$ISO" 4) -eq 808469571 ] && menuitem "$@"
974 }
976 burnable()
977 {
978 [ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] &&
979 menuitem "$@"
980 }
982 blankable()
983 {
984 [ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] &&
985 menuitem "$@"
986 }
988 burniso()
989 {
990 wodim -v speed=$(fgrep "drive speed" /proc/sys/dev/cdrom/info | cut -f3) \
991 -eject -multi "$ISO"
992 }
994 blankcd()
995 {
996 wodim -v -blank=fast
997 }
999 customsector()
1000 {
1001 local c=$(echo $(get 32848 "$ISO" 4))
1002 hascustomconf $(($c+16)) && echo $(($c+16)) || echo $c
1003 }
1005 xhascustomconf=hascustomconf
1006 hascustomconf()
1007 {
1008 [ "$(ddq bs=2k skip=${1:-$(customsector)} if="$ISO" | ddq bs=1 count=6)" \
1009 = "#!boot" ]
1010 }
1012 gotcustomconf()
1013 {
1014 hascustomconf && menuitem "$@"
1015 }
1017 hasflavor()
1018 {
1019 [ -x /usr/bin/tazlito ] && [ -s $(maybe64 $media/boot/bzImage) ] && menuitem "$@"
1020 }
1022 gotisomd5()
1023 {
1024 [ "$(which md5sum 2> /dev/null)" ] &&
1025 [ $(get 0 "$ISO") -eq 23117 ] &&
1026 [ $(get 18 "$ISO") -ne 0 ] && menuitem "$@"
1027 }
1029 read_return()
1030 {
1031 echo -e "\rPress RETURN to continue."
1032 read n
1033 }
1035 getcustomconf()
1036 {
1037 ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
1038 case "$line" in
1039 \#!boot*) ;;
1040 append=*) echo ${line#append=} > cmdline && ls -l $PWD/cmdline ;;
1041 initrd:*) cnt=${line#initrd:}
1042 { ddq bs=512 count=$(($cnt / 512));
1043 ddq bs=1 count=$(($cnt % 512)); } > initrd &&
1044 ls -l $PWD/initrd
1045 break ;;
1046 *) break ;;
1047 esac
1048 done
1049 [ "$1" ] || read_return
1050 }
1052 setcustomconf()
1053 {
1054 msg="$(stat -c '%12s %.16z %n' $PWD/cmdline $PWD/initrd 2>/dev/null|sed 'N;s|\n|\\n|')"
1055 [ "$msg" ] || msg="These files are not found. Your configuration will be cleared.\\n"
1056 msg="\nUpdate the custom configuration with the files cmdline and initrd\n
1057 in the current directory $PWD. Any missing file is assumed empty.\n\n$msg"
1058 [ "$1" ] && echo -e "$msg" ||
1059 $DIALOG --clear --title " Update custom configuration " \
1060 --yes-label "Update config" --yesno "$msg\n
1061 \nAre you sure to do the update ?\n" 0 0
1062 [ $? -eq 0 ] || return
1063 ddq bs=2k seek=$(customsector) of="$ISO" count=0
1064 if [ "$(ls $PWD/cmdline $PWD/inird 2> /dev/null)" ]; then
1065 rm -f /tmp/custom$$ 2>/dev/null
1066 [ -s $PWD/cmdline ] &&
1067 echo "append=$(cat $PWD/cmdline)" >>/tmp/custom$$
1068 [ -s $PWD/initrd ] &&
1069 echo "initrd:$(size $PWD/initrd)" >>/tmp/custom$$ &&
1070 cat $PWD/initrd >>/tmp/custom$$
1071 echo "#!boot $(md5sum /tmp/custom$$ | sed 's| .*||')" >>"$ISO"
1072 cat /tmp/custom$$ >>"$ISO"
1073 dd if=/dev/zero bs=4k count=1 >>"$ISO"
1074 rm -f /tmp/custom$$
1075 fi
1076 }
1078 isomd5()
1079 {
1080 dotwait "Checking iso image"
1081 [ "$(ddq if="$ISO" bs=2k skip=16 \
1082 count=$(($(get 32848 "$ISO" 4)-16)) | md5sum)" = \
1083 "$(ddq if="$ISO" bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \
1084 sed 's/ //g') -" ] && echo "OK" || echo "ERROR"
1085 echo -en "\rChecking iso hybrid boot..."
1086 n=$(($(get 2 "$ISO")-1+($(get 4 "$ISO")-1)*512))
1087 if [ $n -lt 40000 -a $n -gt 32768 ]; then
1088 s=$(get 0 "$ISO" 2 $n | awk '{ i+= $0 } END { print i }')
1089 [ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] &&
1090 echo "OK" || echo "ERROR"
1091 fi
1092 if hascustomconf; then
1093 echo -en "\rChecking iso custom config..."
1094 TMP=/tmp/$(basename $0)$$md5
1095 md5="$(ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
1096 case "$line" in
1097 \#!boot*) echo ${line#*boot } > $TMP ;;
1098 append=*) echo $line ;;
1099 initrd:*) echo $line
1100 cnt=${line#initrd:}
1101 ddq bs=512 count=$((cnt / 512))
1102 ddq bs=1 count=$((cnt % 512))
1103 break ;;
1104 *) break ;;
1105 esac
1106 done | md5sum | cut -c1-32)"
1107 [ "$md5" = "$(cat $TMP)" ] && echo "OK" || echo "ERROR"
1108 rm -f $TMP
1109 fi
1110 rm -f /tmp/wait
1111 [ "$1" ] || read_return
1112 }
1114 usbdev()
1115 {
1116 dotwait "Wait 5 seconds for USB devices"
1117 sleep 5
1118 rm -f /tmp/wait
1119 DEV="$(grep -l 1 /sys/block/*/removable | \
1120 sed 's|/sys/block/\(.*\)/removable|\1|')"
1121 [ "$DEV" ] || return
1122 cat > /tmp/dialog$$ <<EOT
1123 $DIALOG --clear --title " Select your USB key " \
1124 --menu "\nPlease select the USB key according to its known size.\n\n" \
1125 0 0 0 \
1126 $(for i in $DEV ; do
1127 grep -qs 1 /sys/block/$i/ro ||
1128 echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2> /dev/null)\" "
1129 done) \
1131 EOT
1132 exec 3>&1
1133 device=$(. /tmp/dialog$$ 2>&1 1>&3)
1134 rm -f /tmp/dialog$$
1135 retval=$?
1136 exec 3>&-
1137 rm -f /tmp/dialog$$
1138 [ $retval -eq 0 ]
1139 }
1141 tazusbmsg()
1142 {
1143 [ "$(which tazusb 2> /dev/null)" ] || return
1144 echo "You should choose 'USB key read/write installation' to be
1145 able to save the package updates or your own configuration and data files.\n\n"
1146 }
1148 gpt_crc32()
1149 {
1150 t0=00000000; t1=77073096; t2=EE0E612C; t3=990951BA;
1151 t4=076DC419; t5=706AF48F; t6=E963A535; t7=9E6495A3;
1152 t8=0EDB8832; t9=79DCB8A4; t10=E0D5E91E; t11=97D2D988;
1153 t12=09B64C2B; t13=7EB17CBD; t14=E7B82D07; t15=90BF1D91;
1154 t16=1DB71064; t17=6AB020F2; t18=F3B97148; t19=84BE41DE;
1155 t20=1ADAD47D; t21=6DDDE4EB; t22=F4D4B551; t23=83D385C7;
1156 t24=136C9856; t25=646BA8C0; t26=FD62F97A; t27=8A65C9EC;
1157 t28=14015C4F; t29=63066CD9; t30=FA0F3D63; t31=8D080DF5;
1158 t32=3B6E20C8; t33=4C69105E; t34=D56041E4; t35=A2677172;
1159 t36=3C03E4D1; t37=4B04D447; t38=D20D85FD; t39=A50AB56B;
1160 t40=35B5A8FA; t41=42B2986C; t42=DBBBC9D6; t43=ACBCF940;
1161 t44=32D86CE3; t45=45DF5C75; t46=DCD60DCF; t47=ABD13D59;
1162 t48=26D930AC; t49=51DE003A; t50=C8D75180; t51=BFD06116;
1163 t52=21B4F4B5; t53=56B3C423; t54=CFBA9599; t55=B8BDA50F;
1164 t56=2802B89E; t57=5F058808; t58=C60CD9B2; t59=B10BE924;
1165 t60=2F6F7C87; t61=58684C11; t62=C1611DAB; t63=B6662D3D;
1166 t64=76DC4190; t65=01DB7106; t66=98D220BC; t67=EFD5102A;
1167 t68=71B18589; t69=06B6B51F; t70=9FBFE4A5; t71=E8B8D433;
1168 t72=7807C9A2; t73=0F00F934; t74=9609A88E; t75=E10E9818;
1169 t76=7F6A0DBB; t77=086D3D2D; t78=91646C97; t79=E6635C01;
1170 t80=6B6B51F4; t81=1C6C6162; t82=856530D8; t83=F262004E;
1171 t84=6C0695ED; t85=1B01A57B; t86=8208F4C1; t87=F50FC457;
1172 t88=65B0D9C6; t89=12B7E950; t90=8BBEB8EA; t91=FCB9887C;
1173 t92=62DD1DDF; t93=15DA2D49; t94=8CD37CF3; t95=FBD44C65;
1174 t96=4DB26158; t97=3AB551CE; t98=A3BC0074; t99=D4BB30E2;
1175 t100=4ADFA541; t101=3DD895D7; t102=A4D1C46D; t103=D3D6F4FB;
1176 t104=4369E96A; t105=346ED9FC; t106=AD678846; t107=DA60B8D0;
1177 t108=44042D73; t109=33031DE5; t110=AA0A4C5F; t111=DD0D7CC9;
1178 t112=5005713C; t113=270241AA; t114=BE0B1010; t115=C90C2086;
1179 t116=5768B525; t117=206F85B3; t118=B966D409; t119=CE61E49F;
1180 t120=5EDEF90E; t121=29D9C998; t122=B0D09822; t123=C7D7A8B4;
1181 t124=59B33D17; t125=2EB40D81; t126=B7BD5C3B; t127=C0BA6CAD;
1182 t128=EDB88320; t129=9ABFB3B6; t130=03B6E20C; t131=74B1D29A;
1183 t132=EAD54739; t133=9DD277AF; t134=04DB2615; t135=73DC1683;
1184 t136=E3630B12; t137=94643B84; t138=0D6D6A3E; t139=7A6A5AA8;
1185 t140=E40ECF0B; t141=9309FF9D; t142=0A00AE27; t143=7D079EB1;
1186 t144=F00F9344; t145=8708A3D2; t146=1E01F268; t147=6906C2FE;
1187 t148=F762575D; t149=806567CB; t150=196C3671; t151=6E6B06E7;
1188 t152=FED41B76; t153=89D32BE0; t154=10DA7A5A; t155=67DD4ACC;
1189 t156=F9B9DF6F; t157=8EBEEFF9; t158=17B7BE43; t159=60B08ED5;
1190 t160=D6D6A3E8; t161=A1D1937E; t162=38D8C2C4; t163=4FDFF252;
1191 t164=D1BB67F1; t165=A6BC5767; t166=3FB506DD; t167=48B2364B;
1192 t168=D80D2BDA; t169=AF0A1B4C; t170=36034AF6; t171=41047A60;
1193 t172=DF60EFC3; t173=A867DF55; t174=316E8EEF; t175=4669BE79;
1194 t176=CB61B38C; t177=BC66831A; t178=256FD2A0; t179=5268E236;
1195 t180=CC0C7795; t181=BB0B4703; t182=220216B9; t183=5505262F;
1196 t184=C5BA3BBE; t185=B2BD0B28; t186=2BB45A92; t187=5CB36A04;
1197 t188=C2D7FFA7; t189=B5D0CF31; t190=2CD99E8B; t191=5BDEAE1D;
1198 t192=9B64C2B0; t193=EC63F226; t194=756AA39C; t195=026D930A;
1199 t196=9C0906A9; t197=EB0E363F; t198=72076785; t199=05005713;
1200 t200=95BF4A82; t201=E2B87A14; t202=7BB12BAE; t203=0CB61B38;
1201 t204=92D28E9B; t205=E5D5BE0D; t206=7CDCEFB7; t207=0BDBDF21;
1202 t208=86D3D2D4; t209=F1D4E242; t210=68DDB3F8; t211=1FDA836E;
1203 t212=81BE16CD; t213=F6B9265B; t214=6FB077E1; t215=18B74777;
1204 t216=88085AE6; t217=FF0F6A70; t218=66063BCA; t219=11010B5C;
1205 t220=8F659EFF; t221=F862AE69; t222=616BFFD3; t223=166CCF45;
1206 t224=A00AE278; t225=D70DD2EE; t226=4E048354; t227=3903B3C2;
1207 t228=A7672661; t229=D06016F7; t230=4969474D; t231=3E6E77DB;
1208 t232=AED16A4A; t233=D9D65ADC; t234=40DF0B66; t235=37D83BF0;
1209 t236=A9BCAE53; t237=DEBB9EC5; t238=47B2CF7F; t239=30B5FFE9;
1210 t240=BDBDF21C; t241=CABAC28A; t242=53B39330; t243=24B4A3A6;
1211 t244=BAD03605; t245=CDD70693; t246=54DE5729; t247=23D967BF;
1212 t248=B3667A2E; t249=C4614AB8; t250=5D681B02; t251=2A6F2B94;
1213 t252=B40BBE37; t253=C30C8EA1; t254=5A05DF1B; t255=2D02EF8D;
1214 crc=$((0xFFFFFFFF))
1215 dd if=$device bs=1 skip=$(($1)) count=$(($2)) 2> /dev/null | \
1216 od -v -w1 -t u1 -An | {
1217 while read n; do
1218 local x=$((($crc ^ $n) & 255))
1219 eval x=0x\$t$x
1220 crc=$(((($crc >> 8) & 0x00FFFFFF) ^ $x))
1221 done
1222 echo $(($crc ^ 0xFFFFFFFF))
1223 }
1224 }
1226 usbbootkey()
1227 {
1228 if [ -b "$1" ]; then
1229 device=$1
1230 elif [ "$1" ]; then
1231 echo "Invalid USB key device"
1232 return 1
1233 else
1234 $DIALOG --clear --title " Create a USB boot key " \
1235 --yes-label "Continue" --yesno \
1236 "\nThe USB key will be used like a CD-ROM. You will not be able to write
1237 any data on the boot partition.\n\n
1238 An extra FAT32 partition will be created with the remaining free space.\n\n
1239 $(tazusbmsg)Please plug your USB stick in now.\n" 16 70
1240 [ $? -eq 0 ] || return
1241 usbdev || return
1242 fi
1244 # perform dd in progress bar
1245 max=$(($(sectcnt "$ISO")/2048))
1246 i=0; while [ $i -le $max ]; do
1247 ddq if="$ISO" bs=1024k count=1 skip=$i seek=$i of=$device
1248 echo $((($i*100)/$max))
1249 i=$(($i+1))
1250 done | { [ "$1" ] || dialog --gauge \
1251 " The ISO image transfer can be long. Please wait..." \
1252 6 70 0 > /dev/tty 2>&1; }
1254 # GPT partition + fat32 format for the remaining space
1255 sectors=$(($(sectcnt $device)-1))
1256 quads2bin $sectors | ddq bs=1 seek=458 of=$device # pmbr
1257 quads2bin 0 | ddq bs=1 seek=$((512+16)) of=$device
1258 quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((512+48)) of=$device
1259 uudecode - <<EOT | gunzip | ddn bs=128 seek=9 of=$device # partiton fat32
1260 begin-base64 644 -
1261 H4sIAAAAAAACA1u04MLrpzuNXdoPZGzbrjbz+C/fHwyfEro9Z7E93Fi5/8sH
1262 BhzAiSGRoZghkyGZQYEhBcguAWIFhgIgWQRkZ4JxPkMeAyEAAOuEo7uAAAAA
1263 ====
1264 EOT
1265 last=$(sectcnt "$ISO")
1266 custom=$((4*$(get 32848 $device 4)))
1267 [ $custom -gt $(($last-4)) ] && last=$(($custom+4)) # room for cmdline
1268 quads2bin $last 0 | ddq bs=1 seek=$((1024+128+32)) of=$device # vfat first address
1269 quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((1024+128+40)) of=$device # vfat last address
1270 quads2bin $(gpt_crc32 1024 $(($(get 596 $device 4)*$(get 592 $device 4)))) | \
1271 ddq bs=1 seek=$((512+88)) of=$device # CRC32 partitions
1272 ddn of=$device if=$device bs=512 skip=1 seek=$sectors count=1
1273 ddn of=$device if=$device bs=512 skip=2 seek=$(($sectors-1)) count=1
1274 quads2bin $sectors 0 1 0 | ddq bs=1 seek=$(($sectors*512+24)) of=$device # my gpt, alt gpt
1275 quads2bin 1 0 $sectors 0 | ddq bs=1 seek=$((512+24)) of=$device # my gpt, alt gpt
1276 quads2bin $(($sectors-1)) 0 | ddq bs=1 seek=$(($sectors*512+72)) of=$device
1277 i=$(get 524 $device 4)
1278 quads2bin $(gpt_crc32 $(($sectors*512)) $i) | \
1279 ddq bs=1 seek=$(($sectors*512+16)) of=$device # CRC32 header
1280 quads2bin $(gpt_crc32 512 $i) | ddq bs=1 seek=$((512+16)) of=$device # CRC32 header
1281 partprobe $device
1282 homedev=/dev/$(basename /sys/block/${device#/dev/}/${device#/dev/}*2)
1283 mkdosfs -n 'SLITAZ HOME' $homedev
1285 # update boot/exe crc16
1286 words2bin 0 | ddq bs=1 seek=18 of=$device
1287 i=$(($(get 2 $device) - 1 + ($(get 4 $device) - 1)*512))
1288 i=$(($(od -v -N $i -t u2 -w2 -An $device | \
1289 awk '{ i+= $0 } END { print (i % 65536) }') \
1290 + $(get $(($i+1)) $device 1)))
1291 words2bin $(( (-$i -1) % 65536 )) | ddq bs=1 seek=18 of=$device
1293 [ "$1" ] || $DIALOG --clear --title " Set /home persistent " \
1294 --yes-label "Continue" --yesno \
1295 "\nThe USB key will run fully in ram. The datas will be lost after each reboot.\n\n
1296 This option will mount /home on the USB key vfat during the boot process.\n\n
1297 Your own data will be saved, but the system stay not upgradable.\n" 16 70
1298 if [ $? -eq 0 ]; then
1299 data="append=home=$(blkid $homedev | sed 's|.* UUID="||;s|".*||') kmap=$(cat /etc/keymap.conf) lang=${LANG%.UTF*} tz=$(cat /etc/TZ) loadfs"
1300 cat <<EOT | ddn bs=512 seek=$custom of=$device
1301 #!boot $(echo "$data" | md5sum | sed 's/ .*//')
1302 $data
1303 --
1304 EOT
1305 fi
1306 }
1308 usbkey()
1309 {
1310 $DIALOG --clear --title " Create a SliTaz USB key " \
1311 --yes-label "Continue" --yesno \
1312 "\nUnlike a hard drive install, the filesystem is kept in a compressed
1313 rootfs.gz. The filesystem is loaded entirely into memory upon boot.
1314 This should increase responsiveness, protect the filesystem against
1315 accidental corruption and reduce read/writes to the USB drive.
1316 Once setup, the tazusb utility can rewrite the root filesystem
1317 with any changes you have made since booting up,
1318 giving the effective benefits of a hard drive install.\n\n
1319 /home is mounted on boot using the UUID of your particular flash drive.
1320 Unlike a device name, the UUID has the benefit of never changing from machine
1321 to machine.\n\n
1322 Please plug your USB stick in now.\n" 19 70
1323 [ $? -eq 0 ] || return
1324 usbdev || return
1325 exec 3>&1
1326 format=`$DIALOG --clear \
1327 --title " Select the filesystem " \
1328 --radiolist "\nPlease select the filesystem type to create.\n\n\
1329 The filesystem creation will erase all the data in the USB key." 14 70 4 \
1330 "none" "Do not erase the USB key" on \
1331 "ext3" "Ext3 journaling filesystem" off \
1332 "ext2" "Ext2 filesystem" off \
1333 "fat32" "Windows FAT32 filesystem" off \
1334 2>&1 1>&3`
1335 retval=$?
1336 exec 3>&-
1337 [ $retval -eq 0 ] || return
1338 [ "$format" != "none" ] && tazusb format $device "SliTaz" $format
1339 tazusb gen-iso2usb "$ISO" $device
1340 }
1342 flavdata()
1343 {
1344 [ $(get 1024 "$ISO") -eq 35615 ] && n=2 || n=$((1+$(get 417 "$ISO" 1)))
1345 [ $n -eq 4 ] && n=20
1346 [ $(get $(($n*512)) "$ISO") -eq 35615 ] || n=13
1347 ddq if="$ISO" bs=512 skip=$n count=20 | zcat 2>/dev/null
1348 }
1350 hasflavinfo()
1351 {
1352 [ "$(flavdata | ddq bs=1 count=7)" = "0707010" ] && menuitem "$@"
1353 }
1355 showfavinfo()
1356 {
1357 mkdir -p /tmp/data
1358 flavdata | ( cd /tmp/data ; cpio -i )
1359 file=/tmp/data/info
1360 cat /tmp/data/*desc > $file
1361 if [ -s /tmp/data/*receipt ]; then
1362 echo "=== receipt ==="
1363 cat /tmp/data/*receipt
1364 fi >> $file
1365 for i in /tmp/data/*list* ; do
1366 echo "=== extra ${i#*list} files"
1367 cat $i
1368 done >> $file
1369 if [ "$1" ]; then
1370 cat $file
1371 else
1372 $DIALOG --clear --title " Flavor info " \
1373 --textbox $file 0 0
1374 fi
1375 rm -rf /tmp/data
1376 }
1378 flavor()
1379 {
1380 name="$(flavdata | cpio -t 2> /dev/null | sed 's/.[a-z]*$//;q')"
1381 echo "Create ${name:=flavor}.flavor..."
1382 tazlito iso2flavor "$ISO" $name
1383 ls -l $name.flavor 2> /dev/null && return
1384 sleep 5
1385 [ "$1" ] || read_return
1386 }
1388 if [ "$1" = "--build" ]; then #install-begin
1389 uuencode -m - < ifmem.bin | sed -e '/^ifmemcode$/r/dev/stdin' \
1390 -e '/^ifmemcode$/d' -i $0
1391 uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \
1392 -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0
1393 exit
1394 fi #install-end
1395 parse_isolinux()
1396 {
1397 awk 'BEGIN { IGNORECASE=1 }
1398 function multi(n)
1399 {
1400 auto=$n
1401 for (--n; n < NF; n+=2) {
1402 s=$n
1403 if (s ~ /M$/) s = substr(s,0,length(s)-1)
1404 else s /= 1024
1405 sizes=int(s) " " sizes
1406 }
1407 next
1408 }
1409 {
1410 if ($1 == "LABEL") {
1411 label=$2
1412 if (auto == "") auto=label
1413 }
1414 if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2
1415 if ($1 == "INITRD") initrd[label]=$2
1416 if ($1 == "APPEND") {
1417 i=2
1418 if (kernel[label] ~ "ifmem.c32") multi(3)
1419 if (kernel[label] ~ "c32box.c32") {
1420 if ($2 == "linux") { kernel[label]=$3; i=4 }
1421 if ($2 == "ifmem") multi(4)
1422 }
1423 if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next }
1424 while (i <= NF) {
1425 if ($i ~ "^initrd=") initrd[label]=substr($i,8)
1426 else cmdline[label]=cmdline[label] " " $i
1427 i++
1428 }
1429 }
1430 }
1431 END {
1432 print "KERNEL=\"" kernel[auto] "\""
1433 print "INITRD=\"" initrd[auto] "\""
1434 print "CMDLINE=\"" substr(cmdline[auto],2) "\""
1435 print "SIZES=\"" sizes "\""
1436 }'
1437 }
1439 locase()
1440 {
1441 echo "$1" | tr [A-Z] [a-z]
1442 }
1444 ifmemcode()
1445 {
1446 uudecode <<EOT
1447 ifmemcode
1448 EOT
1449 }
1451 floppyset()
1452 {
1453 gotcdfile 'isolinux.cfg'
1454 $0 include $file | parse_isolinux > /tmp/var$$
1455 . /tmp/var$$
1456 [ -z "$KERNEL" ] && echo "Can't parse isolinux.cfg" && return
1457 for i in $media/$KERNEL $(dirname $file)/$KERNEL $media/$(locase $KERNEL) \
1458 $(dirname $file)/$(locase $KERNEL); do
1459 i="$(ls $i* | sed q)"
1460 [ -n "$i" ] && KERNEL=$i && break
1461 done
1462 rm -f /tmp/var$$
1463 [ $(get 514 $KERNEL 4) -eq 1400005704 ] || return
1464 n=$(($(get 497 $KERNEL 1)+1))
1465 ddq bs=512 count=$n if=$KERNEL of=/tmp/fd$$
1466 uudecode <<EOT | ddn of=/tmp/fd$$
1467 bootloader
1468 EOT
1469 pos=$(($n*512))
1470 if [ -n "$CMDLINE" ]; then
1471 echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$
1472 bytes2bin $n | ddn bs=1 seek=497 of=/tmp/fd$$
1473 words2bin $pos | ddn bs=1 seek=34 of=/tmp/fd$$
1474 [ $(get 518 $KERNEL 4) -ge 514 ] &&
1475 words2bin 32768 9 | ddn bs=1 seek=552 of=/tmp/fd$$
1476 fi
1477 syssize=$(echo $(get 500 /tmp/fd$$ 4))
1478 ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \
1479 ddq bs=512 count=$((($syssize+31)/32)) conv=sync >> /tmp/fd$$
1480 base=$(size /tmp/fd$$)
1481 len=
1482 if [ "$INITRD" ]; then
1483 l=0
1484 for i in ${INITRD//,/ }; do
1485 for j in $media/$i $(dirname $KERNEL)/$i $media/$(locase $i) \
1486 $(dirname $KERNEL)/$(locase $i); do
1487 j="$(ls $j* | sed q)"
1488 [ -n "$j" ] && i=$j && break
1489 done
1490 ddq if=$i >> /tmp/fd$$
1491 l=$(($l+$(size $i)))
1492 r=$((4 - ($l % 4)))
1493 if [ $r -ne 4 ]; then
1494 ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$
1495 l=$(($l + $r))
1496 fi
1497 case "$i:$INITRD" in
1498 *rootfs.gz:*rootfs.gz,*) continue # loram
1499 esac
1500 len="$len $l"; l=0
1501 done
1502 rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))}
1503 quads2bin $rdadrs | ddn bs=1 seek=536 of=/tmp/fd$$
1504 fi
1505 n=$(echo $len | wc -w)
1506 if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then
1507 i=$(($(get 494 /tmp/fd$$)))
1508 bytes2bin $(($i + ($n*4) - 256)) | ddn bs=1 \
1509 seek=496 of=/tmp/fd$$
1510 else
1511 i=$(($pos + 0x1FC - ($n*4)))
1512 bytes2bin $(($i % 256)) $((i / 256)) 252 | ddn bs=1 \
1513 seek=494 of=/tmp/fd$$
1514 s=$(($i - 2*$(echo "$SIZES" | wc -w)))
1515 p=$(($s - $(ifmemcode | wc -c)))
1516 ifmemcode | ddn bs=1 seek=$p of=/tmp/fd$$
1517 words2bin $SIZES | ddn bs=1 seek=$s of=/tmp/fd$$
1518 bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \
1519 ddn bs=1 seek=60 of=/tmp/fd$$
1520 fi
1521 for r in $len ; do
1522 quads2bin $r | ddn bs=1 seek=$i of=/tmp/fd$$
1523 i=$(($i + 4))
1524 done
1525 split -b 1440k /tmp/fd$$ fd$$
1526 rm -f /tmp/fd$$
1527 n=1; i=0; r=0
1528 set -- $len
1529 ls fd$$* | while read file ; do
1530 if [ $i -ge $(($1+$base)) ]; then
1531 base=$(($1+$base-$i))
1532 shift
1533 r=$(($r+100)); n=0; i=0
1534 fi
1535 ddq of=$file bs=18k seek=80 count=0
1536 i=$(($i+1474560))
1537 printf "mv %s fd%03d.img\n" $file $(($r+$n))
1538 n=$(($n+1))
1539 done | sh
1540 du -ch $PWD/fd???.img
1541 }
1543 quit()
1544 {
1545 umount -d $media
1546 rmdir $media
1547 ${1:-exit}
1548 }
1550 infoiso()
1551 {
1552 isoinfo -d -i "$ISO" > /tmp/isoinfo$$ 2> /dev/null
1553 if [ "$(which iso2exe)" ]; then
1554 echo "----"
1555 blkid "$ISO" | while read args; do
1556 set -- $args
1557 while [ -n "$2" ]; do
1558 case "$2" in
1559 *UUID*|PT*) echo $2;;
1560 esac
1561 shift
1562 done
1563 done
1564 if ! fdisk -l "$ISO" | grep -q 'valid partition'; then
1565 fdisk -l "$ISO" | grep heads
1566 fdisk -l "$ISO" | sed 's/^ *[^ ]* *//;s/ */ /g;$!d'
1567 fi
1568 echo "----"
1569 iso2exe -l "$ISO"
1570 fi >> /tmp/isoinfo$$
1571 if [ "$1" ]; then
1572 cat /tmp/isoinfo$$
1573 else
1574 $DIALOG --clear --title " Info ISO " \
1575 --textbox /tmp/isoinfo$$ 0 0
1576 files=$(sed '/^custom.*d/!d;s| .*||' /tmp/isoinfo$$)
1577 if [ "$files" ]; then
1578 $DIALOG --clear --title " Extract custom files " \
1579 --defaultno --yesno \
1580 "Do you want to extract the custom boot files ?\n$files" 7 70
1581 [ $? -eq 0 ] && for i in $files ; do
1582 echo "Extract $i ..."
1583 iso2exe -l "$ISO" $i
1584 done
1585 fi
1586 fi
1587 rm -f /tmp/isoinfo$$
1588 }
1590 isotitle()
1591 {
1592 echo "$(blkid "$ISO" | sed 's/.*LABEL="\([^"]*\).*/\1/') $(stat \
1593 -c %y $media/.|sed 's/ .*//') $(basename "$ISO")"
1594 }
1596 if [ $0 = /init.exe ]; then
1598 case "${ISO##*/}$(getarg mode)" in
1599 *install*|*INSTALL*) install;;
1600 *live*|*LIVE*) live;;
1601 *text*|*TEXT*) text;;
1602 esac
1603 dmesg > /tmp/dmesg
1605 else
1607 if [ "$1" = "include" ]; then
1608 [ -s "$2" ] && cd $(dirname "$2") && awk -v exe=$0 \
1609 '{ if ($1 == "include") system(exe " include " $2); else print }' <"$2"
1610 exit
1611 fi
1612 ISO="${1:-/dev/null}"
1613 while [ -L "$ISO" ]; do
1614 media="$(readlink "$ISO")"
1615 case "$media" in
1616 /*) ISO="$media" ;;
1617 *) ISO="$(dirname "$ISO")/$media" ;;
1618 esac
1619 done
1620 [ "${ISO:0:1}" != "/" ] && ISO="$(cd $(dirname "$ISO"); echo $PWD/$(basename "$ISO"))"
1621 [ -z "$(isiso 2> /dev/null)" ] && echo "Usage : $0 file.iso" && exit 1
1622 media=/tmp/media$$
1623 mkdir -p $media
1624 mount -o loop,ro "$ISO" $media
1626 if [ "$2" = "list" ]; then
1627 sed '/^\$(.*") \\/!d;s/^\$(\(.*\)").*/\1"/' $0 | while read line; do
1628 eval $line
1629 echo
1630 done | sed '/^$/d;/"usbkey"/d'
1631 quit
1632 fi
1633 if grep -q "^$2()" $0; then
1634 exe=$2
1635 shift 2
1636 if [ -n "$(eval $(grep "\"$exe\"" $0 | sed \
1637 '/^\$/!d;s/.(\(.*\)[\t ]*".*"[\t ]*".*/\1/'))" ]; then
1638 isotitle
1639 grep "\"$exe\"" $0 | sed '/^\$/!d;s/.*"[\t ]*"\(.*\)".*/\1/'
1640 echo ----
1641 $exe "$@"
1642 fi
1643 quit
1644 fi
1645 fi
1647 while true; do
1648 keymap="$(cat /etc/keymap.conf 2>/dev/null)"
1649 locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)"
1650 cat > /tmp/dialog$$ <<EOT
1651 $DIALOG --clear --title " $(isotitle) " --menu "" 28 70 30 \
1652 $(initxfile tazkeymap "tazkeymap" "Select keyboard (${keymap:-none})") \
1653 $(initxfile tazlocale "tazlocale" "Select locale (${locale:-none})") \
1654 $(initx "live" "Linux RAM boot (full desktop)") \
1655 $(initx "text" "Linux RAM boot") \
1656 $(cdfile 'README*' "readme" "Show the README file") \
1657 $(gotcustomconf "getcustomconf" "Get custom config") \
1658 $(noinit "setcustomconf" "Set custom config") \
1659 $(gotisomd5 "isomd5" "Check the ISO image") \
1660 $(cdfile 'md5sum*' "md5" "Check the ISO files") \
1661 $(cdfile 'sha*sum*' "sha" "Check the ISO files") \
1662 $(menuitem "filepos" "File start sector") \
1663 $(xfile 'isoinfo iso2exe' "infoiso" "ISO image info") \
1664 $(cdfilex 'bzImage*' "bootiso" "Boot the ISO image") \
1665 $(burnable "burniso" "Burn the ISO image") \
1666 $(blankable "blankcd" "Blank the CD/DVD") \
1667 $(gotposixovl "install" "Hard disk installation (UMSDOS way)") \
1668 $(gotposixovl "installtaz" "Hard disk installation (TAZUSB way)") \
1669 $(gotposixovlzip "inst2zip" "ZIP installation archive (UMSDOS way)") \
1670 $(gotposixovlzip "insttaz2zip" "ZIP installation archive (TAZUSB way)") \
1671 $(gottazusb "usbkey" "USB key read/write installation") \
1672 $(ishybrid "usbbootkey" "USB boot key (not upgradable)") \
1673 $(hasflavinfo "showfavinfo" "Show flavor extra info") \
1674 $(hasflavor "flavor" "Get flavor file") \
1675 $(cdfile isolinux.cfg "floppyset" "Boot floppy set") \
1676 $(cdfile linld.com "tazboot" "Get tazboot.exe Linux loader for DOS") \
1677 $(cdexe 'bzImage*' "bzimage" "Get linux DOS/EXE file") \
1678 $(cdexe 'memtest*' "memtest" "Get Memtest86 DOS/EXE file") \
1679 $(cdfilef 'memtest*' "fdmemtest" "Create a Memtest86 boot floppy") \
1680 $(cdexe '?pxe*' "pxe" "Get SliTaz Web boot DOS/EXE utility") \
1681 $(cdfilef '?pxe*' "fdpxe" "Create a SliTaz Web boot floppy") \
1682 $(cdexe 'plop*' "plop" "Get USB boot DOS/EXE utility") \
1683 $(cdfilef 'plop*' "fdplop" "Create a USB boot floppy") \
1684 $(initxfile reboot "restart" "Restart the computer") \
1685 $(initxfile poweroff "stop" "Power off") \
1686 $(initx "bootlog" "Linux boot messages") \
1687 $(initx "shell" "Shell prompt") \
1688 $(noinitmisspkg "missing" "Install packages to get more options") \
1689 $(noinit "quit" "Quit this utility")
1690 EOT
1691 exec 3>&1
1692 value=$(. /tmp/dialog$$ 2>&1 1>&3)
1693 retval=$?
1694 exec 3>&-
1695 rm -f /tmp/dialog$$
1696 [ $retval -ne 0 ] && [ $0 != /init.exe ] && quit
1697 $value
1698 done