wok view syslinux/stuff/iso2exe/taziso @ rev 23956

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