wok-6.x view syslinux/stuff/iso2exe/taziso @ rev 23996

linld: add iso support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jan 08 20:15:35 2021 +0000 (2021-01-08)
parents b7c7891464b1
children 670e65815150
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.exe \
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*)
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
459 [ -x $mnt/slitaz/sbin/init ] || return
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 gotcdfile()
697 {
698 for i in "$media/$1" "$media/*/$1" "$media/*/isolinux/$1" ; do
699 file=$(ls $i 2> /dev/null | sed q)
700 [ -s "$file" ] && break
701 done
702 }
704 sha()
705 {
706 gotcdfile 'sha*sum*'
707 sha=$(basename $file)
708 md5sum="${sha%sum*}sum -c ${file#$media/}"
709 md5 $@
710 }
712 readme()
713 {
714 gotcdfile 'README*'
715 if [ "$1" ]; then
716 cat $file
717 else
718 $DIALOG --clear --title " Readme " --textbox $file 0 0
719 fi
720 }
722 bzimage()
723 {
724 if [ -z "$1" ]; then
725 $DIALOG --clear --title " Create linux.exe ? " \
726 --yes-label "Install" --yesno \
727 "\nLinux.exe launches the linux kernel under DOS (in real mode only).
728 The cmdline arguments are supported except initrd=,
729 vga= (you can try 'rdev -v') and mem= (partially).
730 \nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n" 12 70
731 [ $? -eq 0 ] || return
732 fi
733 cp $(maybe64 $media/boot/bzImage) linux.exe
734 du -h $PWD/linux.exe
735 }
737 memtest()
738 {
739 if [ -z "$1" ]; then
740 $DIALOG --clear --title " Create memtest.exe ? " \
741 --yes-label "Install" --yesno \
742 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
743 computers. BIOS based memory tests are a quick, cursory check and often
744 miss many of the failures that are detected by Memtest86.\n" 0 0
745 [ $? -eq 0 ] || return
746 fi
747 gotcdfile 'memtest*' && cp $file memtest.exe
748 du -h $PWD/memtest.exe
749 }
751 mkfat12()
752 {
753 [ $(($(get 0 $1) - 0x5A4D)) -eq 0 ] || return
754 J=$(($(get 3 $1 1) + 0x02))
755 R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
756 [ $R -lt 2500 ] || return
757 [ $((($(get 500 $1)-1) & 31)) -lt 30 ] &&
758 ddq if=$file bs=32 count=1 seek=$(($R*16 - 1)) of=/dev/fd0
759 G="18 0 2 0 0 0 0 0"
760 [ $J -gt 25 ] || G=""
761 F=0
762 for i in 1 2 3; do
763 F=$((((2880-$R-$F-$F)*3+1023)/1024))
764 done
765 bytes2bin 0xEB $J 0x90 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 \
766 0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \
767 $G | ddq bs=1 of=/dev/fd0
768 ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0
769 for i in $R $(($R+$F)) ; do
770 bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
771 done
772 echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
773 }
775 mkfloppy()
776 {
777 dotwait "Create a $(basename $1 .exe) boot floppy"
778 ddq if=$1 of=/dev/fd0
779 mkfat12 $1
780 rm -f /tmp/wait
781 }
783 fdmemtest()
784 {
785 if [ -z "$1" ]; then
786 $DIALOG --clear --title " Create a Memtest86 boot floppy " \
787 --yes-label "Create floppy" --yesno \
788 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
789 computers. BIOS based memory tests are a quick, cursory check and often
790 miss many of the failures that are detected by Memtest86.\n\n
791 Please insert a blank disk in floppy drive.\n" 0 0
792 [ $? -eq 0 ] || return
793 fi
794 gotcdfile 'memtest*' && mkfloppy $file
795 }
797 pxe()
798 {
799 gotcdfile '?pxe*'
800 if [ -z "$1" ]; then
801 $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
802 --yes-label "Install" --yesno \
803 "\nBoot your operating system from the internet and enjoy a full system
804 working entirely in RAM with speed and stability in mind. The Linux Kernel
805 and the complete SliTaz compressed root filesystem will be loaded into RAM
806 from the Web using PXE and HTTP protocols.\n" 0 0
807 [ $? -eq 0 ] || return
808 fi
809 cp $file $(basename $file .exe).exe
810 du -h $PWD/$(basename $file .exe).exe
811 }
813 fdpxe()
814 {
815 if [ -z "$1" ]; then
816 $DIALOG --clear --title " Create a SliTaz Web boot floppy " \
817 --yes-label "Create floppy" --yesno \
818 "\nBoot your operating system from the internet and enjoy a full system
819 working entirely in RAM with speed and stability in mind. The Linux Kernel
820 and the complete SliTaz compressed root filesystem will be loaded into RAM
821 from the Web using PXE and HTTP protocols.\n\n
822 Please insert a blank disk in floppy drive.\n" 0 0
823 [ $? -eq 0 ] || return
824 fi
825 gotcdfile '?pxe*' && mkfloppy $file
826 }
828 plop()
829 {
830 gotcdfile 'plop.exe'
831 if [ -z "$1" ]; then
832 $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
833 --yes-label "Install" --yesno \
834 "\nBoot your operating system from a USB disk without BIOS support.\n" 0 0
835 [ $? -eq 0 ] || return
836 fi
837 cp $file $(basename $file .exe).exe
838 du -h $PWD/$(basename $file .exe).exe
839 }
841 fdplop()
842 {
843 if [ -z "$1" ]; then
844 $DIALOG --clear --title " Create a Plop boot floppy " \
845 --yes-label "Create floppy" --yesno \
846 "\nBoot your operating system from a USB disk without BIOS support.\n\n
847 Please insert a blank disk in floppy drive.\n" 0 0
848 [ $? -eq 0 ] || return
849 fi
850 gotcdfile 'plop.exe' && mkfloppy $file
851 }
853 menuitem()
854 {
855 [ "$3" ] && shift
856 echo -en "\"$1\" \"$2\""
857 }
859 gotposixovl()
860 {
861 mount.posixovl 2>&1 | grep -qi usage && gotcdfile 'rootfs*.gz' &&
862 menuitem "$@"
863 }
865 gotposixovlzip()
866 {
867 [ "$(which zip)" ] && gotposixovl "$1" "$2"
868 }
870 noinit()
871 {
872 [ $0 = /init.exe ] || menuitem "$@"
873 }
875 initx()
876 {
877 [ $0 = /init.exe ] && menuitem "$@"
878 }
880 xfile()
881 {
882 [ "$(which $1)" ] && menuitem "$@"
883 }
885 initxfile()
886 {
887 [ $0 = /init.exe ] && xfile "$@"
888 }
890 cdfile()
891 {
892 gotcdfile "$1" && menuitem "$@"
893 }
895 gottazusb()
896 {
897 gotcdfile 'rootfs*.gz' && xfile tazusb "$@"
898 }
900 isbzImage()
901 {
902 [ $(get 514 $file 4) -eq 1400005704 ] &&
903 [ $(($(get 529 $file 1) & 1)) -eq 1 ]
904 }
906 cdfilex()
907 {
908 gotcdfile "$1" && [ "$(which kexec)" ] && isbzImage && menuitem "$@"
909 }
911 cdfilef()
912 {
913 [ -e /sys/block/fd0 ] && cdfile "$@"
914 }
916 cdexe()
917 {
918 gotcdfile "$1" &&
919 [ $(get 0 $file 2>/dev/null || echo 0) -eq 23117 ] &&
920 [ $(get 128 $file 2>/dev/null || echo 0) -ne 10 ] &&
921 menuitem "$@"
922 }
924 misspkg()
925 {
926 for i in zip kexec-tools posixovl cdrkit cdrkit-isoinfo ; do
927 [ -d /var/lib/tazpkg/installed/$i/ ] && continue
928 [ "$1" != "install" ] && menuitem "$@" && return
929 tazpkg get-install $i
930 done
931 }
933 noinitmisspkg()
934 {
935 [ $0 = /init.exe ] || misspkg "$@"
936 }
938 missing()
939 {
940 misspkg install
941 }
943 ishybrid()
944 {
945 [ $(get 510 "$ISO") -eq 43605 ] || return
946 C=$((2048*$(get $(((17*2048) + 71)) "$ISO" 4)))
947 [ $(get $C "$ISO" 4) -eq 1 ] || return
948 [ $(get $(($C+30)) "$ISO" 4) -eq $((0x88AA55)) ] || return
949 C=$((2048*$(get $(($C+40)) "$ISO" 4)))
950 [ $(get $(($C+64)) "$ISO" 4) -eq 1886961915 ] && menuitem "$@"
951 }
953 isiso()
954 {
955 [ $(get 32769 "$ISO" 4) -eq 808469571 ] && menuitem "$@"
956 }
958 burnable()
959 {
960 [ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] &&
961 menuitem "$@"
962 }
964 blankable()
965 {
966 [ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info 2> /dev/null)" ] &&
967 menuitem "$@"
968 }
970 burniso()
971 {
972 wodim -v speed=$(fgrep "drive speed" /proc/sys/dev/cdrom/info | cut -f3) \
973 -eject -multi "$ISO"
974 }
976 blankcd()
977 {
978 wodim -v -blank=fast
979 }
981 customsector()
982 {
983 local c=$(echo $(get 32848 "$ISO" 4))
984 hascustomconf $(($c+16)) && echo $(($c+16)) || echo $c
985 }
987 xhascustomconf=hascustomconf
988 hascustomconf()
989 {
990 [ "$(ddq bs=2k skip=${1:-$(customsector)} if="$ISO" | ddq bs=1 count=6)" \
991 = "#!boot" ]
992 }
994 gotcustomconf()
995 {
996 hascustomconf && menuitem "$@"
997 }
999 hasflavor()
1001 [ -x /usr/bin/tazlito ] && [ -s $(maybe64 $media/boot/bzImage) ] && menuitem "$@"
1004 gotisomd5()
1006 [ "$(which md5sum 2> /dev/null)" ] &&
1007 [ $(get 0 "$ISO") -eq 23117 ] &&
1008 [ $(get 18 "$ISO") -ne 0 ] && menuitem "$@"
1011 read_return()
1013 echo -e "\rPress RETURN to continue."
1014 read n
1017 getcustomconf()
1019 ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
1020 case "$line" in
1021 \#!boot*) ;;
1022 append=*) echo ${line#append=} > cmdline && ls -l $PWD/cmdline ;;
1023 initrd:*) cnt=${line#initrd:}
1024 { ddq bs=512 count=$(($cnt / 512));
1025 ddq bs=1 count=$(($cnt % 512)); } > initrd &&
1026 ls -l $PWD/initrd
1027 break ;;
1028 *) break ;;
1029 esac
1030 done
1031 [ "$1" ] || read_return
1034 setcustomconf()
1036 msg="$(stat -c '%12s %.16z %n' $PWD/cmdline $PWD/initrd 2>/dev/null|sed 'N;s|\n|\\n|')"
1037 [ "$msg" ] || msg="These files are not found. Your configuration will be cleared.\\n"
1038 msg="\nUpdate the custom configuration with the files cmdline and initrd\n
1039 in the current directory $PWD. Any missing file is assumed empty.\n\n$msg"
1040 [ "$1" ] && echo -e "$msg" ||
1041 $DIALOG --clear --title " Update custom configuration " \
1042 --yes-label "Update config" --yesno "$msg\n
1043 \nAre you sure to do the update ?\n" 0 0
1044 [ $? -eq 0 ] || return
1045 ddq bs=2k seek=$(customsector) of="$ISO" count=0
1046 if [ "$(ls $PWD/cmdline $PWD/inird 2> /dev/null)" ]; then
1047 rm -f /tmp/custom$$ 2>/dev/null
1048 [ -s $PWD/cmdline ] &&
1049 echo "append=$(cat $PWD/cmdline)" >>/tmp/custom$$
1050 [ -s $PWD/initrd ] &&
1051 echo "initrd:$(size $PWD/initrd)" >>/tmp/custom$$ &&
1052 cat $PWD/initrd >>/tmp/custom$$
1053 echo "#!boot $(md5sum /tmp/custom$$ | sed 's| .*||')" >>"$ISO"
1054 cat /tmp/custom$$ >>"$ISO"
1055 dd if=/dev/zero bs=4k count=1 >>"$ISO"
1056 rm -f /tmp/custom$$
1057 fi
1060 isomd5()
1062 dotwait "Checking iso image"
1063 [ "$(ddq if="$ISO" bs=2k skip=16 \
1064 count=$(($(get 32848 "$ISO" 4)-16)) | md5sum)" = \
1065 "$(ddq if="$ISO" bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \
1066 sed 's/ //g') -" ] && echo "OK" || echo "ERROR"
1067 echo -en "\rChecking iso hybrid boot..."
1068 n=$(($(get 2 "$ISO")-1+($(get 4 "$ISO")-1)*512))
1069 if [ $n -lt 40000 -a $n -gt 32768 ]; then
1070 s=$(get 0 "$ISO" 2 $n | awk '{ i+= $0 } END { print i }')
1071 [ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] &&
1072 echo "OK" || echo "ERROR"
1073 fi
1074 if hascustomconf; then
1075 echo -en "\rChecking iso custom config..."
1076 TMP=/tmp/$(basename $0)$$md5
1077 md5="$(ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
1078 case "$line" in
1079 \#!boot*) echo ${line#*boot } > $TMP ;;
1080 append=*) echo $line ;;
1081 initrd:*) echo $line
1082 cnt=${line#initrd:}
1083 ddq bs=512 count=$((cnt / 512))
1084 ddq bs=1 count=$((cnt % 512))
1085 break ;;
1086 *) break ;;
1087 esac
1088 done | md5sum | cut -c1-32)"
1089 [ "$md5" = "$(cat $TMP)" ] && echo "OK" || echo "ERROR"
1090 rm -f $TMP
1091 fi
1092 rm -f /tmp/wait
1093 [ "$1" ] || read_return
1096 usbdev()
1098 dotwait "Wait 5 seconds for USB devices"
1099 sleep 5
1100 rm -f /tmp/wait
1101 DEV="$(grep -l 1 /sys/block/*/removable | \
1102 sed 's|/sys/block/\(.*\)/removable|\1|')"
1103 [ "$DEV" ] || return
1104 cat > /tmp/dialog$$ <<EOT
1105 $DIALOG --clear --title " Select your USB key " \
1106 --menu "\nPlease select the USB key according to its known size.\n\n" \
1107 0 0 0 \
1108 $(for i in $DEV ; do
1109 grep -qs 1 /sys/block/$i/ro ||
1110 echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2> /dev/null)\" "
1111 done) \
1113 EOT
1114 exec 3>&1
1115 device=$(. /tmp/dialog$$ 2>&1 1>&3)
1116 rm -f /tmp/dialog$$
1117 retval=$?
1118 exec 3>&-
1119 rm -f /tmp/dialog$$
1120 [ $retval -eq 0 ]
1123 tazusbmsg()
1125 [ "$(which tazusb 2> /dev/null)" ] || return
1126 echo "You should choose 'USB key read/write installation' to be
1127 able to save the package updates or your own configuration and data files.\n\n"
1130 gpt_crc32()
1132 t0=00000000; t1=77073096; t2=EE0E612C; t3=990951BA;
1133 t4=076DC419; t5=706AF48F; t6=E963A535; t7=9E6495A3;
1134 t8=0EDB8832; t9=79DCB8A4; t10=E0D5E91E; t11=97D2D988;
1135 t12=09B64C2B; t13=7EB17CBD; t14=E7B82D07; t15=90BF1D91;
1136 t16=1DB71064; t17=6AB020F2; t18=F3B97148; t19=84BE41DE;
1137 t20=1ADAD47D; t21=6DDDE4EB; t22=F4D4B551; t23=83D385C7;
1138 t24=136C9856; t25=646BA8C0; t26=FD62F97A; t27=8A65C9EC;
1139 t28=14015C4F; t29=63066CD9; t30=FA0F3D63; t31=8D080DF5;
1140 t32=3B6E20C8; t33=4C69105E; t34=D56041E4; t35=A2677172;
1141 t36=3C03E4D1; t37=4B04D447; t38=D20D85FD; t39=A50AB56B;
1142 t40=35B5A8FA; t41=42B2986C; t42=DBBBC9D6; t43=ACBCF940;
1143 t44=32D86CE3; t45=45DF5C75; t46=DCD60DCF; t47=ABD13D59;
1144 t48=26D930AC; t49=51DE003A; t50=C8D75180; t51=BFD06116;
1145 t52=21B4F4B5; t53=56B3C423; t54=CFBA9599; t55=B8BDA50F;
1146 t56=2802B89E; t57=5F058808; t58=C60CD9B2; t59=B10BE924;
1147 t60=2F6F7C87; t61=58684C11; t62=C1611DAB; t63=B6662D3D;
1148 t64=76DC4190; t65=01DB7106; t66=98D220BC; t67=EFD5102A;
1149 t68=71B18589; t69=06B6B51F; t70=9FBFE4A5; t71=E8B8D433;
1150 t72=7807C9A2; t73=0F00F934; t74=9609A88E; t75=E10E9818;
1151 t76=7F6A0DBB; t77=086D3D2D; t78=91646C97; t79=E6635C01;
1152 t80=6B6B51F4; t81=1C6C6162; t82=856530D8; t83=F262004E;
1153 t84=6C0695ED; t85=1B01A57B; t86=8208F4C1; t87=F50FC457;
1154 t88=65B0D9C6; t89=12B7E950; t90=8BBEB8EA; t91=FCB9887C;
1155 t92=62DD1DDF; t93=15DA2D49; t94=8CD37CF3; t95=FBD44C65;
1156 t96=4DB26158; t97=3AB551CE; t98=A3BC0074; t99=D4BB30E2;
1157 t100=4ADFA541; t101=3DD895D7; t102=A4D1C46D; t103=D3D6F4FB;
1158 t104=4369E96A; t105=346ED9FC; t106=AD678846; t107=DA60B8D0;
1159 t108=44042D73; t109=33031DE5; t110=AA0A4C5F; t111=DD0D7CC9;
1160 t112=5005713C; t113=270241AA; t114=BE0B1010; t115=C90C2086;
1161 t116=5768B525; t117=206F85B3; t118=B966D409; t119=CE61E49F;
1162 t120=5EDEF90E; t121=29D9C998; t122=B0D09822; t123=C7D7A8B4;
1163 t124=59B33D17; t125=2EB40D81; t126=B7BD5C3B; t127=C0BA6CAD;
1164 t128=EDB88320; t129=9ABFB3B6; t130=03B6E20C; t131=74B1D29A;
1165 t132=EAD54739; t133=9DD277AF; t134=04DB2615; t135=73DC1683;
1166 t136=E3630B12; t137=94643B84; t138=0D6D6A3E; t139=7A6A5AA8;
1167 t140=E40ECF0B; t141=9309FF9D; t142=0A00AE27; t143=7D079EB1;
1168 t144=F00F9344; t145=8708A3D2; t146=1E01F268; t147=6906C2FE;
1169 t148=F762575D; t149=806567CB; t150=196C3671; t151=6E6B06E7;
1170 t152=FED41B76; t153=89D32BE0; t154=10DA7A5A; t155=67DD4ACC;
1171 t156=F9B9DF6F; t157=8EBEEFF9; t158=17B7BE43; t159=60B08ED5;
1172 t160=D6D6A3E8; t161=A1D1937E; t162=38D8C2C4; t163=4FDFF252;
1173 t164=D1BB67F1; t165=A6BC5767; t166=3FB506DD; t167=48B2364B;
1174 t168=D80D2BDA; t169=AF0A1B4C; t170=36034AF6; t171=41047A60;
1175 t172=DF60EFC3; t173=A867DF55; t174=316E8EEF; t175=4669BE79;
1176 t176=CB61B38C; t177=BC66831A; t178=256FD2A0; t179=5268E236;
1177 t180=CC0C7795; t181=BB0B4703; t182=220216B9; t183=5505262F;
1178 t184=C5BA3BBE; t185=B2BD0B28; t186=2BB45A92; t187=5CB36A04;
1179 t188=C2D7FFA7; t189=B5D0CF31; t190=2CD99E8B; t191=5BDEAE1D;
1180 t192=9B64C2B0; t193=EC63F226; t194=756AA39C; t195=026D930A;
1181 t196=9C0906A9; t197=EB0E363F; t198=72076785; t199=05005713;
1182 t200=95BF4A82; t201=E2B87A14; t202=7BB12BAE; t203=0CB61B38;
1183 t204=92D28E9B; t205=E5D5BE0D; t206=7CDCEFB7; t207=0BDBDF21;
1184 t208=86D3D2D4; t209=F1D4E242; t210=68DDB3F8; t211=1FDA836E;
1185 t212=81BE16CD; t213=F6B9265B; t214=6FB077E1; t215=18B74777;
1186 t216=88085AE6; t217=FF0F6A70; t218=66063BCA; t219=11010B5C;
1187 t220=8F659EFF; t221=F862AE69; t222=616BFFD3; t223=166CCF45;
1188 t224=A00AE278; t225=D70DD2EE; t226=4E048354; t227=3903B3C2;
1189 t228=A7672661; t229=D06016F7; t230=4969474D; t231=3E6E77DB;
1190 t232=AED16A4A; t233=D9D65ADC; t234=40DF0B66; t235=37D83BF0;
1191 t236=A9BCAE53; t237=DEBB9EC5; t238=47B2CF7F; t239=30B5FFE9;
1192 t240=BDBDF21C; t241=CABAC28A; t242=53B39330; t243=24B4A3A6;
1193 t244=BAD03605; t245=CDD70693; t246=54DE5729; t247=23D967BF;
1194 t248=B3667A2E; t249=C4614AB8; t250=5D681B02; t251=2A6F2B94;
1195 t252=B40BBE37; t253=C30C8EA1; t254=5A05DF1B; t255=2D02EF8D;
1196 crc=$((0xFFFFFFFF))
1197 dd if=$device bs=1 skip=$(($1)) count=$(($2)) 2> /dev/null | \
1198 od -v -w1 -t u1 -An | {
1199 while read n; do
1200 local x=$((($crc ^ $n) & 255))
1201 eval x=0x\$t$x
1202 crc=$(((($crc >> 8) & 0x00FFFFFF) ^ $x))
1203 done
1204 echo $(($crc ^ 0xFFFFFFFF))
1208 usbbootkey()
1210 if [ -b "$1" ]; then
1211 device=$1
1212 elif [ "$1" ]; then
1213 echo "Invalid USB key device"
1214 return 1
1215 else
1216 $DIALOG --clear --title " Create a USB boot key " \
1217 --yes-label "Continue" --yesno \
1218 "\nThe USB key will be used like a CD-ROM. You will not be able to write
1219 any data on the boot partition.\n\n
1220 An extra FAT32 partition will be created with the remaining free space.\n\n
1221 $(tazusbmsg)Please plug your USB stick in now.\n" 16 70
1222 [ $? -eq 0 ] || return
1223 usbdev || return
1224 fi
1226 # perform dd in progress bar
1227 max=$(($(sectcnt "$ISO")/2048))
1228 i=0; while [ $i -le $max ]; do
1229 ddq if="$ISO" bs=1024k count=1 skip=$i seek=$i of=$device
1230 echo $((($i*100)/$max))
1231 i=$(($i+1))
1232 done | { [ "$1" ] || dialog --gauge \
1233 " The ISO image transfer can be long. Please wait..." \
1234 6 70 0 > /dev/tty 2>&1; }
1236 # GPT partition + fat32 format for the remaining space
1237 sectors=$(($(sectcnt $device)-1))
1238 quads2bin $sectors | ddq bs=1 seek=458 of=$device # pmbr
1239 quads2bin 0 | ddq bs=1 seek=$((512+16)) of=$device
1240 quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((512+48)) of=$device
1241 uudecode - <<EOT | gunzip | ddn bs=128 seek=9 of=$device # partiton fat32
1242 begin-base64 644 -
1243 H4sIAAAAAAACA1u04MLrpzuNXdoPZGzbrjbz+C/fHwyfEro9Z7E93Fi5/8sH
1244 BhzAiSGRoZghkyGZQYEhBcguAWIFhgIgWQRkZ4JxPkMeAyEAAOuEo7uAAAAA
1245 ====
1246 EOT
1247 last=$(sectcnt "$ISO")
1248 custom=$((4*$(get 32848 $device 4)))
1249 [ $custom -gt $(($last-4)) ] && last=$(($custom+4)) # room for cmdline
1250 quads2bin $last 0 | ddq bs=1 seek=$((1024+128+32)) of=$device # vfat first address
1251 quads2bin $(($sectors-2)) 0 | ddq bs=1 seek=$((1024+128+40)) of=$device # vfat last address
1252 quads2bin $(gpt_crc32 1024 $(($(get 596 $device 4)*$(get 592 $device 4)))) | \
1253 ddq bs=1 seek=$((512+88)) of=$device # CRC32 partitions
1254 ddn of=$device if=$device bs=512 skip=1 seek=$sectors count=1
1255 ddn of=$device if=$device bs=512 skip=2 seek=$(($sectors-1)) count=1
1256 quads2bin $sectors 0 1 0 | ddq bs=1 seek=$(($sectors*512+24)) of=$device # my gpt, alt gpt
1257 quads2bin 1 0 $sectors 0 | ddq bs=1 seek=$((512+24)) of=$device # my gpt, alt gpt
1258 quads2bin $(($sectors-1)) 0 | ddq bs=1 seek=$(($sectors*512+72)) of=$device
1259 i=$(get 524 $device 4)
1260 quads2bin $(gpt_crc32 $(($sectors*512)) $i) | \
1261 ddq bs=1 seek=$(($sectors*512+16)) of=$device # CRC32 header
1262 quads2bin $(gpt_crc32 512 $i) | ddq bs=1 seek=$((512+16)) of=$device # CRC32 header
1263 partprobe $device
1264 homedev=/dev/$(basename /sys/block/${device#/dev/}/${device#/dev/}*2)
1265 mkdosfs -n 'SLITAZ HOME' $homedev
1267 # update boot/exe crc16
1268 words2bin 0 | ddq bs=1 seek=18 of=$device
1269 i=$(($(get 2 $device) - 1 + ($(get 4 $device) - 1)*512))
1270 i=$(($(od -v -N $i -t u2 -w2 -An $device | \
1271 awk '{ i+= $0 } END { print (i % 65536) }') \
1272 + $(get $(($i+1)) $device 1)))
1273 words2bin $(( (-$i -1) % 65536 )) | ddq bs=1 seek=18 of=$device
1275 [ "$1" ] || $DIALOG --clear --title " Set /home persistent " \
1276 --yes-label "Continue" --yesno \
1277 "\nThe USB key will run fully in ram. The datas will be lost after each reboot.\n\n
1278 This option will mount /home on the USB key vfat during the boot process.\n\n
1279 Your own data will be saved, but the system stay not upgradable.\n" 16 70
1280 if [ $? -eq 0 ]; then
1281 data="append=home=$(blkid $homedev | sed 's|.* UUID="||;s|".*||') kmap=$(cat /etc/keymap.conf) lang=${LANG%.UTF*} tz=$(cat /etc/TZ) loadfs"
1282 cat <<EOT | ddn bs=512 seek=$custom of=$device
1283 #!boot $(echo "$data" | md5sum | sed 's/ .*//')
1284 $data
1285 --
1286 EOT
1287 fi
1290 usbkey()
1292 $DIALOG --clear --title " Create a SliTaz USB key " \
1293 --yes-label "Continue" --yesno \
1294 "\nUnlike a hard drive install, the filesystem is kept in a compressed
1295 rootfs.gz. The filesystem is loaded entirely into memory upon boot.
1296 This should increase responsiveness, protect the filesystem against
1297 accidental corruption and reduce read/writes to the USB drive.
1298 Once setup, the tazusb utility can rewrite the root filesystem
1299 with any changes you have made since booting up,
1300 giving the effective benefits of a hard drive install.\n\n
1301 /home is mounted on boot using the UUID of your particular flash drive.
1302 Unlike a device name, the UUID has the benefit of never changing from machine
1303 to machine.\n\n
1304 Please plug your USB stick in now.\n" 19 70
1305 [ $? -eq 0 ] || return
1306 usbdev || return
1307 exec 3>&1
1308 format=`$DIALOG --clear \
1309 --title " Select the filesystem " \
1310 --radiolist "\nPlease select the filesystem type to create.\n\n\
1311 The filesystem creation will erase all the data in the USB key." 14 70 4 \
1312 "none" "Do not erase the USB key" on \
1313 "ext3" "Ext3 journaling filesystem" off \
1314 "ext2" "Ext2 filesystem" off \
1315 "fat32" "Windows FAT32 filesystem" off \
1316 2>&1 1>&3`
1317 retval=$?
1318 exec 3>&-
1319 [ $retval -eq 0 ] || return
1320 [ "$format" != "none" ] && tazusb format $device "SliTaz" $format
1321 tazusb gen-iso2usb "$ISO" $device
1324 flavdata()
1326 [ $(get 1024 "$ISO") -eq 35615 ] && n=2 || n=$((1+$(get 417 "$ISO" 1)))
1327 [ $n -eq 4 ] && n=20
1328 [ $(get $(($n*512)) "$ISO") -eq 35615 ] || n=13
1329 ddq if="$ISO" bs=512 skip=$n count=20 | zcat 2>/dev/null
1332 hasflavinfo()
1334 [ "$(flavdata | ddq bs=1 count=7)" = "0707010" ] && menuitem "$@"
1337 showfavinfo()
1339 mkdir -p /tmp/data
1340 flavdata | ( cd /tmp/data ; cpio -i )
1341 file=/tmp/data/info
1342 cat /tmp/data/*desc > $file
1343 if [ -s /tmp/data/*receipt ]; then
1344 echo "=== receipt ==="
1345 cat /tmp/data/*receipt
1346 fi >> $file
1347 for i in /tmp/data/*list* ; do
1348 echo "=== extra ${i#*list} files"
1349 cat $i
1350 done >> $file
1351 if [ "$1" ]; then
1352 cat $file
1353 else
1354 $DIALOG --clear --title " Flavor info " \
1355 --textbox $file 0 0
1356 fi
1357 rm -rf /tmp/data
1360 flavor()
1362 name="$(flavdata | cpio -t 2> /dev/null | sed 's/.[a-z]*$//;q')"
1363 echo "Create ${name:=flavor}.flavor..."
1364 tazlito iso2flavor "$ISO" $name
1365 ls -l $name.flavor 2> /dev/null && return
1366 sleep 5
1367 [ "$1" ] || read_return
1370 if [ "$1" = "--build" ]; then #install-begin
1371 uuencode -m - < ifmem.bin | sed -e '/^ifmemcode$/r/dev/stdin' \
1372 -e '/^ifmemcode$/d' -i $0
1373 uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \
1374 -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0
1375 exit
1376 fi #install-end
1377 parse_isolinux()
1379 awk 'BEGIN { IGNORECASE=1 }
1380 function multi(n)
1382 auto=$n
1383 for (--n; n < NF; n+=2) {
1384 s=$n
1385 if (s ~ /M$/) s = substr(s,0,length(s)-1)
1386 else s /= 1024
1387 sizes=int(s) " " sizes
1389 next
1392 if ($1 == "LABEL") {
1393 label=$2
1394 if (auto == "") auto=label
1396 if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2
1397 if ($1 == "INITRD") initrd[label]=$2
1398 if ($1 == "APPEND") {
1399 i=2
1400 if (kernel[label] ~ "ifmem.c32") multi(3)
1401 if (kernel[label] ~ "c32box.c32") {
1402 if ($2 == "linux") { kernel[label]=$3; i=4 }
1403 if ($2 == "ifmem") multi(4)
1405 if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next }
1406 while (i <= NF) {
1407 if ($i ~ "^initrd=") initrd[label]=substr($i,8)
1408 else cmdline[label]=cmdline[label] " " $i
1409 i++
1413 END {
1414 print "KERNEL=\"" kernel[auto] "\""
1415 print "INITRD=\"" initrd[auto] "\""
1416 print "CMDLINE=\"" substr(cmdline[auto],2) "\""
1417 print "SIZES=\"" sizes "\""
1418 }'
1421 locase()
1423 echo "$1" | tr [A-Z] [a-z]
1426 ifmemcode()
1428 uudecode <<EOT
1429 ifmemcode
1430 EOT
1433 floppyset()
1435 gotcdfile 'isolinux.cfg'
1436 $0 include $file | parse_isolinux > /tmp/var$$
1437 . /tmp/var$$
1438 [ -z "$KERNEL" ] && echo "Can't parse isolinux.cfg" && return
1439 for i in $media/$KERNEL $(dirname $file)/$KERNEL $media/$(locase $KERNEL) \
1440 $(dirname $file)/$(locase $KERNEL); do
1441 i="$(ls $i* | sed q)"
1442 [ -n "$i" ] && KERNEL=$i && break
1443 done
1444 rm -f /tmp/var$$
1445 [ $(get 514 $KERNEL 4) -eq 1400005704 ] || return
1446 n=$(($(get 497 $KERNEL 1)+1))
1447 ddq bs=512 count=$n if=$KERNEL of=/tmp/fd$$
1448 uudecode <<EOT | ddn of=/tmp/fd$$
1449 bootloader
1450 EOT
1451 pos=$(($n*512))
1452 if [ -n "$CMDLINE" ]; then
1453 echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$
1454 bytes2bin $n | ddn bs=1 seek=497 of=/tmp/fd$$
1455 words2bin $pos | ddn bs=1 seek=34 of=/tmp/fd$$
1456 [ $(get 518 $KERNEL 4) -ge 514 ] &&
1457 words2bin 32768 9 | ddn bs=1 seek=552 of=/tmp/fd$$
1458 fi
1459 syssize=$(echo $(get 500 /tmp/fd$$ 4))
1460 ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \
1461 ddq bs=512 count=$((($syssize+31)/32)) conv=sync >> /tmp/fd$$
1462 base=$(size /tmp/fd$$)
1463 len=
1464 if [ "$INITRD" ]; then
1465 l=0
1466 for i in ${INITRD//,/ }; do
1467 for j in $media/$i $(dirname $KERNEL)/$i $media/$(locase $i) \
1468 $(dirname $KERNEL)/$(locase $i); do
1469 j="$(ls $j* | sed q)"
1470 [ -n "$j" ] && i=$j && break
1471 done
1472 ddq if=$i >> /tmp/fd$$
1473 l=$(($l+$(size $i)))
1474 r=$((4 - ($l % 4)))
1475 if [ $r -ne 4 ]; then
1476 ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$
1477 l=$(($l + $r))
1478 fi
1479 case "$i:$INITRD" in
1480 *rootfs.gz:*rootfs.gz,*) continue # loram
1481 esac
1482 len="$len $l"; l=0
1483 done
1484 rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))}
1485 quads2bin $rdadrs | ddn bs=1 seek=536 of=/tmp/fd$$
1486 fi
1487 n=$(echo $len | wc -w)
1488 if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then
1489 i=$(($(get 494 /tmp/fd$$)))
1490 bytes2bin $(($i + ($n*4) - 256)) | ddn bs=1 \
1491 seek=496 of=/tmp/fd$$
1492 else
1493 i=$(($pos + 0x1FC - ($n*4)))
1494 bytes2bin $(($i % 256)) $((i / 256)) 252 | ddn bs=1 \
1495 seek=494 of=/tmp/fd$$
1496 s=$(($i - 2*$(echo "$SIZES" | wc -w)))
1497 p=$(($s - $(ifmemcode | wc -c)))
1498 ifmemcode | ddn bs=1 seek=$p of=/tmp/fd$$
1499 words2bin $SIZES | ddn bs=1 seek=$s of=/tmp/fd$$
1500 bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \
1501 ddn bs=1 seek=60 of=/tmp/fd$$
1502 fi
1503 for r in $len ; do
1504 quads2bin $r | ddn bs=1 seek=$i of=/tmp/fd$$
1505 i=$(($i + 4))
1506 done
1507 split -b 1440k /tmp/fd$$ fd$$
1508 rm -f /tmp/fd$$
1509 n=1; i=0; r=0
1510 set -- $len
1511 ls fd$$* | while read file ; do
1512 if [ $i -gt $(($1+$base)) ]; then
1513 shift
1514 r=$(($r+100)); n=0; i=0; base=0
1515 fi
1516 ddq of=$file bs=18k seek=80 count=0
1517 i=$(($i+1474560))
1518 printf "mv %s fd%03d.img\n" $file $(($r+$n))
1519 n=$(($n+1))
1520 done | sh
1521 du -ch $PWD/fd???.img
1524 quit()
1526 umount -d $media
1527 rmdir $media
1528 ${1:-exit}
1531 infoiso()
1533 isoinfo -d -i "$ISO" > /tmp/isoinfo$$
1534 if [ -x "$(which iso2exe)" ]; then
1535 echo "----"
1536 blkid "$ISO" | while read args; do
1537 set -- $args
1538 while [ -n "$2" ]; do
1539 case "$2" in
1540 *UUID*|PT*) echo $2;;
1541 esac
1542 shift
1543 done
1544 done
1545 if ! fdisk -l "$ISO" | grep -q 'valid partition'; then
1546 fdisk -l "$ISO" | grep heads
1547 fdisk -l "$ISO" | sed 's/^ *[^ ]* *//;s/ */ /g;$!d'
1548 fi
1549 echo "----"
1550 iso2exe -l "$ISO"
1551 fi >> /tmp/isoinfo$$
1552 if [ "$1" ]; then
1553 cat /tmp/isoinfo$$
1554 else
1555 $DIALOG --clear --title " Info ISO " \
1556 --textbox /tmp/isoinfo$$ 0 0
1557 fi
1558 rm -f /tmp/isoinfo$$
1561 isotitle()
1563 echo "$(blkid "$ISO" | sed 's/.*LABEL="\([^"]*\).*/\1/') $(stat \
1564 -c %y $media/.|sed 's/ .*//') $(basename "$ISO")"
1567 if [ $0 = /init.exe ]; then
1569 case "${ISO##*/}$(getarg mode)" in
1570 *install*|*INSTALL*) install;;
1571 *live*|*LIVE*) live;;
1572 *text*|*TEXT*) text;;
1573 esac
1574 dmesg > /tmp/dmesg
1576 else
1578 if [ "$1" = "include" ]; then
1579 [ -s "$2" ] && cd $(dirname "$2") && awk -v exe=$0 \
1580 '{ if ($1 == "include") system(exe " include " $2); else print }' <"$2"
1581 exit
1582 fi
1583 ISO="${1:-/dev/null}"
1584 while [ -L "$ISO" ]; do
1585 media="$(readlink "$ISO")"
1586 case "$media" in
1587 /*) ISO="$media" ;;
1588 *) ISO="$(dirname "$ISO")/$media" ;;
1589 esac
1590 done
1591 [ "${ISO:0:1}" != "/" ] && ISO="$(cd $(dirname "$ISO"); echo $PWD/$(basename "$ISO"))"
1592 [ -z "$(isiso 2> /dev/null)" ] && echo "Usage : $0 file.iso" && exit 1
1593 media=/tmp/media$$
1594 mkdir -p $media
1595 mount -o loop,ro "$ISO" $media
1597 if [ "$2" = "list" ]; then
1598 sed '/^\$(.*") \\/!d;s/^\$(\(.*\)").*/\1"/' $0 | while read line; do
1599 eval $line
1600 echo
1601 done | sed '/^$/d;/"usbkey"/d'
1602 quit
1603 fi
1604 if grep -q "^$2()" $0; then
1605 exe=$2
1606 shift 2
1607 if [ -n "$(eval $(grep "\"$exe\"" $0 | sed \
1608 '/^\$/!d;s/.(\(.*\)[\t ]*".*"[\t ]*".*/\1/'))" ]; then
1609 isotitle
1610 grep "\"$exe\"" $0 | sed '/^\$/!d;s/.*"[\t ]*"\(.*\)".*/\1/'
1611 echo ----
1612 $exe "$@"
1613 fi
1614 quit
1615 fi
1616 fi
1618 while true; do
1619 keymap="$(cat /etc/keymap.conf 2>/dev/null)"
1620 locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)"
1621 cat > /tmp/dialog$$ <<EOT
1622 $DIALOG --clear --title " $(isotitle) " --menu "" 28 70 30 \
1623 $(initxfile tazkeymap "tazkeymap" "Select keyboard (${keymap:-none})") \
1624 $(initxfile tazlocale "tazlocale" "Select locale (${locale:-none})") \
1625 $(initx "live" "Linux RAM boot (full desktop)") \
1626 $(initx "text" "Linux RAM boot") \
1627 $(cdfile 'README*' "readme" "Show the README file") \
1628 $(gotcustomconf "getcustomconf" "Get custom config") \
1629 $(noinit "setcustomconf" "Set custom config") \
1630 $(gotisomd5 "isomd5" "Check the ISO image") \
1631 $(cdfile 'md5sum*' "md5" "Check the ISO files") \
1632 $(cdfile 'sha*sum*' "sha" "Check the ISO files") \
1633 $(xfile isoinfo "infoiso" "ISO image info") \
1634 $(cdfilex 'bzImage*' "bootiso" "Boot the ISO image") \
1635 $(burnable "burniso" "Burn the ISO image") \
1636 $(blankable "blankcd" "Blank the CD/DVD") \
1637 $(gotposixovl "install" "Hard disk installation (UMSDOS way)") \
1638 $(gotposixovl "installtaz" "Hard disk installation (TAZUSB way)") \
1639 $(gotposixovlzip "inst2zip" "ZIP installation archive (UMSDOS way)") \
1640 $(gotposixovlzip "insttaz2zip" "ZIP installation archive (TAZUSB way)") \
1641 $(gottazusb "usbkey" "USB key read/write installation") \
1642 $(ishybrid "usbbootkey" "USB boot key (not upgradable)") \
1643 $(hasflavinfo "showfavinfo" "Show flavor extra info") \
1644 $(hasflavor "flavor" "Get flavor file") \
1645 $(cdfile isolinux.cfg "floppyset" "Boot floppy set") \
1646 $(cdfile linld.com "tazboot" "Get tazboot.exe Linux loader for DOS") \
1647 $(cdexe 'bzImage*' "bzimage" "Get linux DOS/EXE file") \
1648 $(cdexe 'memtest*' "memtest" "Get Memtest86 DOS/EXE file") \
1649 $(cdfilef 'memtest*' "fdmemtest" "Create a Memtest86 boot floppy") \
1650 $(cdexe '?pxe*' "pxe" "Get SliTaz Web boot DOS/EXE utility") \
1651 $(cdfilef '?pxe*' "fdpxe" "Create a SliTaz Web boot floppy") \
1652 $(cdexe 'plop.exe' "plop" "Get USB boot DOS/EXE utility") \
1653 $(cdfilef 'plop.exe' "fdplop" "Create a USB boot floppy") \
1654 $(initxfile reboot "restart" "Restart the computer") \
1655 $(initxfile poweroff "stop" "Power off") \
1656 $(initx "bootlog" "Linux boot messages") \
1657 $(initx "shell" "Shell prompt") \
1658 $(noinitmisspkg "missing" "Install packages to get more options") \
1659 $(noinit "quit" "Quit this utility")
1660 EOT
1661 exec 3>&1
1662 value=$(. /tmp/dialog$$ 2>&1 1>&3)
1663 retval=$?
1664 exec 3>&-
1665 rm -f /tmp/dialog$$
1666 [ $retval -ne 0 ] && [ $0 != /init.exe ] && quit
1667 $value
1668 done