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

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