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

Add hfsprescue
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 14 10:24:30 2014 +0000 (2014-03-14)
parents 9c889f88b9fd
children 3e7ad70145ce
line source
1 #!/bin/sh
3 DIALOG=dialog
5 get()
6 {
7 od -j $1 -N ${3:-2} -t u${3:-2} -An $2 2> /dev/null ||
8 hexdump -s $1 -n ${3:-2} -e "\"\" 1/${3:-2} \"%d\"" $2
9 }
11 getarg()
12 {
13 sed "/$1=/!d;s/.*$1=\\([^ ]*\\).*/\\1/" /proc/cmdline
14 }
16 mount_proc()
17 {
18 mount -t proc /proc /proc
19 mount -t sysfs /sys /sys
20 udevd --daemon 2> /dev/null && udevadm trigger && sleep 5
21 }
23 umount_proc()
24 {
25 killall udevd 2> /dev/null
26 umount /sys/fs/fuse/connections 2> /dev/null
27 umount /sys
28 umount /proc
29 }
31 gettazboot()
32 {
33 echo "Creating $(basename $1) ..."
34 O=$(($(get 66 /mnt/$ISO) - 0xC0))
35 L=$((0x7EE0 - $(get 24 /mnt/$ISO) - $O))
36 S=$((32+$L))
37 P=$((($S+511)/512))
38 E=$((4096-(32*$P)))
39 for i in 0x5A4D $(($S%512)) $P 0 2 $E -1 $((${2:-0}-16)) \
40 -2 0 256 -16 28 0x6C53 0x5469 0x7A61; do
41 printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255)) | \
42 xargs echo -en
43 done > $1
44 dd bs=1 count=$L skip=$(echo $O) if=/mnt/$ISO >> $1 2> /dev/null
45 }
47 checkmagic()
48 {
49 [ -s $1 ] && [ $(getarg magic) == $(get 24 $1 4) ]
50 }
52 getiso()
53 {
54 mkdir -p /media/cdrom
55 blkid | while read dev info ; do
56 mount ${dev%:} /mnt
57 if checkmagic /mnt/$ISO; then
58 mount -o loop,ro /mnt/$ISO /media/cdrom
59 echo "Found $ISO on ${dev%:}"
60 break
61 fi
62 umount /mnt
63 done
64 }
66 uncpio()
67 {
68 echo "Extracting $(basename $1) ..."
69 case $(get 0 $1) in
70 *35615) zcat $1 ;;
71 *\ 93) unlzma -c $1 ;;
72 *) cat $1 ;;
73 esac | ( cd ${2:-/} ; cpio -idmu > /dev/null 2>&1 )
74 }
76 getuuid()
77 {
78 dev=$(mount | sed '/ \/mnt /!d;s/ .*//;s|/dev/||;q')
79 blkid | sed "/$dev:/!d;s/.* UUID=.\\([^ ]*\\)\".*/\\1/"
80 }
82 tazusbinitfs()
83 {
84 PAD=$(($(stat -c %s $1) % 4))
85 [ $PAD -ne 0 ] && dd if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1
86 mkdir -p /tmp/fs/etc /tmp/fs/lib /tmp/fs/home
87 cp -a /etc/locale.conf /tmp/fs/etc 2> /dev/null
88 cp -a /etc/keymap.conf /tmp/fs/etc 2> /dev/null
89 sed 's/ .*//' /proc/modules | while read mod ; do
90 find /lib/modules/ | grep $mod.ko | \
91 sed 's|.*|cp & /tmp/fs/lib|' | sh
92 done
93 cat > /tmp/fs/init1 <<EOT
94 #!/bin/sh
95 sed -i 's|sbin/init|init2|' /init
96 exec /init
97 EOT
98 cat > /tmp/fs/init2 <<EOT
99 #!/bin/sh
101 mount -t proc /proc /proc
102 grep -q debug /proc/cmdline && debug=true && set -x
103 for i in /lib/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
104 v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2> /dev/null)
105 mount / -o remount,rw
106 mkdir /mnt/dos
107 rm -f /cmdline 2> /dev/null
108 mount / -o remount,ro
109 mnt=/mnt/dos/\${v#*/}
110 dev=\$( (blkid /dev/[sh]d* || blkid) | grep \${v%%/*} | sed 's/:.*//;q')
111 echo "Mount \$dev in /mnt/dos for \$v..." | tee -a /run/boot.log
112 mount \$dev /mnt/dos
113 mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
114 mount --bind \$mnt /home
115 [ "\$debug" = "true" ] && sh
116 umount /proc
117 exec /sbin/init
118 EOT
119 chmod 755 /tmp/fs/init?
120 cp -a /tmp/fs/* /
121 ( cd /tmp/fs ; find * | cpio -o -H newc ) | gzip -9 >> $1
122 }
124 mkinitrd()
125 {
126 echo "Creating $(basename $1) ..."
127 for i in bin lib dev proc tmp mnt etc ; do
128 mkdir -p /tmp/fs/$i
129 done
130 for i in /dev/console /dev/null /dev/tty /dev/tty1 /dev/tty2 /dev/fuse \
131 /dev/hd* /dev/sd* ; do
132 cp -a $i /tmp/fs$i
133 done
134 for i in /bin/busybox $(which mount.posixovl) $(which blkid); do
135 cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $i | \
136 sed 's|.*=> \(.*/lib/l[^ ]*\).*|\1|;/^\//!d') /tmp/fs/lib
137 cp $i /tmp/fs/bin
138 done
139 cp -a /lib/ld-* /tmp/fs/lib
140 for i in $(busybox | sed '/Current/,$!d'); do
141 [ -e /tmp/fs/bin/${i%,} ] || ln -s busybox /tmp/fs/bin/${i%,}
142 done
143 ln -s /proc/mounts /tmp/fs/etc/mtab
144 sed 's/ .*//' /proc/modules | while read mod ; do
145 find /lib/modules/ | grep $mod.ko | \
146 sed 's|.*|cp & /tmp/fs/lib|' | sh
147 done
148 cat > /tmp/fs/init <<EOT
149 #!/bin/sh
151 arg()
152 {
153 grep -q \$1 /proc/cmdline &&
154 val="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" < /proc/cmdline)" &&
155 echo "\$2 \$val"
156 }
158 mount -t proc /proc /proc
159 arg debug "shell" && debug=true && set -x
160 for i in /lib/*.ko* ; do insmod \$i 2> /dev/null ; done; sleep 2
161 arg mount "Mount device"
162 mount \$( (blkid /dev/[sh]d* || blkid) | grep \$val | sed 's/:.*//;q') /mnt
163 arg subroot "Change root to directory"
164 mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
165 mount --bind /mnt /mnt/\$val/mnt/dos
166 LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
167 export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
168 [ "$debug" = "true" ] && sh
169 umount /proc
170 exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init
171 EOT
172 chmod +x /tmp/fs/init
173 ( cd /tmp/fs ; find * | cpio -o -H newc ) | lzma e $1 -si 2> /dev/null
174 rm -rf /tmp/fs
175 }
177 is_loram()
178 {
179 [ -s /lib/squashfs.ko* ]
180 }
182 ls_r()
183 {
184 ls -r $@ 2> /dev/null || ls $@
185 }
187 doinstall()
188 {
189 mkdir -p /mnt/slitaz/boot /mnt/slitaz/mnt/dos
190 if ! mount.posixovl -F /mnt/slitaz -- \
191 -oallow_other -odefault_permissions -osuid; then
192 echo "Can't install SliTaz. Abort."
193 sleep 5
194 return 1
195 fi
196 echo "Install root filesystem in /slitaz..."
197 if [ -n "$1" ]; then
198 if [ -d /media/cdrom/fs ]; then
199 ( cd /mnt/slitaz/fs; find | cpio -o -H newc ) | gzip -9
200 else
201 ls_r /media/cdrom/boot/rootfs* | xargs cat
202 fi > /mnt/slitaz/boot/rootfs.gz
203 tazusbinitfs /mnt/slitaz/boot/rootfs.gz
204 initrd=rootfs.gz
205 extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
206 else
207 if [ -d /media/cdrom/fs ]; then
208 cp -a /media/cdrom/fs/. /mnt/slitaz
209 elif is_loram ; then
210 for i in /media/cdrom/boot/rootfs?.* ; do
211 [ -s $(basename $i) ] && continue
212 cpio -i $i
213 done
214 for i in $(ls_r /media/cdrom/boot/rootfs*); do
215 mount -o loop,ro $i /sqfs/mnt
216 cp -a /sqfs/mnt/. /mnt/slitaz
217 umount -d /sqfs/mnt
218 done
219 else
220 for i in $(ls_r /media/cdrom/boot/rootfs*); do
221 uncpio $i /mnt/slitaz
222 done
223 fi
224 cp -a /etc/locale.conf /tmp/slitaz/etc 2> /dev/null
225 cp -a /etc/keymap.conf /tmp/slitaz/etc 2> /dev/null
226 mkinitrd /mnt/slitaz/boot/initrd
227 initrd=initrd
228 extraargs="mount=$(getuuid) subroot=slitaz"
229 fi
230 echo "Install boot files..."
231 for i in /media/cdrom/boot/bzImage /media/cdrom/boot/*pxe* \
232 /media/cdrom/boot/isolinux/he* /media/cdrom/boot/isolinux/opt* \
233 /media/cdrom/README /media/cdrom/boot/memtest* ; do
234 [ -s $i ] && cp $i /mnt/slitaz/boot
235 done
236 for i in /mnt/slitaz/boot/memtest /mnt/slitaz/boot/*pxe* ; do
237 [ $(get 0 $i 2> /dev/null || echo 0) -eq 23117 ] &&
238 mv $i $i.exe
239 done
240 gettazboot /mnt/slitaz/boot/tazboot.exe
241 unix2dos > /mnt/slitaz/boot/tazboot.cmd <<EOT
242 kernel=/slitaz/boot/bzimage
243 initrd=/slitaz/boot/$initrd
244 rw root=/dev/null $extraargs autologin
245 EOT
246 unix2dos /mnt/slitaz/boot/he* /mnt/slitaz/boot/opt* \
247 /mnt/slitaz/boot/README
248 [ -d /mnt/slitaz/usr/sbin -a ! -x /mnt/slitaz/usr/sbin/mount.posixovl ] &&
249 cp $(which mount.posixovl) /mnt/slitaz/usr/sbin
250 false &&
251 ! grep -qs tazboot /mnt/boot.ini && echo "Update boot.ini ..." &&
252 unix2dos >> /mnt/boot.ini <<EOT
253 C:\\slitaz\\boot\\tazboot.exe="SliTaz"
254 EOT
255 false &&
256 grep -qis menuitem /mnt/config.sys && ! grep -qi tazboot /mnt/config.sys &&
257 echo "Update config.sys ..." &&
258 sed -i 's/menudefault/menuitem SLITAZ, SliTaz\r\n&/' /mnt/config.sys &&
259 unix2dos >> /mnt/config.sys <<EOT
260 [SLITAZ]
261 install=\\slitaz\\boot\\tazboot.exe
262 EOT
263 return 0
264 }
266 install()
267 {
268 $DIALOG --clear \
269 --title " SliTaz UMSDOS way installation " \
270 --yes-label "Install" --yesno \
271 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
272 DOS/Windows partition. You will see your files from /mnt/dos.\n\n
273 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
274 To uninstall SliTaz, you have only to remove this directory.
275 The file \\boot.ini or \\config.sys may be modified too.\n\n
276 SliTaz may run slowly on 'UMSDOS way' installation due to the
277 posixovl filesystem. The 'TAZUSB way' installation runs faster.\n\n
278 To do a traditional installation with disk partitioning,
279 start SliTaz Live with 'SliTaz RAM boot' menu.\n
280 " 19 70
281 [ $? -eq 0 ] || return
282 doinstall || return
283 [ -x /mnt/slitaz/sbin/init ] || return
284 umount -d /media/cdrom
285 umount_proc
286 exec chroot /mnt/slitaz /sbin/init
287 }
289 installtaz()
290 {
291 $DIALOG --clear \
292 --title " SliTaz TAZUSB way installation " \
293 --yes-label "Install" --yesno \
294 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
295 DOS/Windows partition. You will see your files from /mnt/dos.\n\n
296 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
297 To uninstall SliTaz, you have only to remove this directory.
298 The file \\boot.ini or \\config.sys may be modified too.\n\n
299 The filesystem is loaded entirely into memory upon boot to
300 increase responsiveness. Only /home lands on hard disk.\n\n
301 To do a traditional installation with disk partitioning,
302 start SliTaz Live with 'SliTaz RAM boot' menu.\n
303 " 19 70
304 [ $? -eq 0 ] || return
305 doinstall tazusblike || return
306 if [ -d /media/cdrom/fs ]; then
307 cp -a /media/cdrom/fs/. /
308 else
309 for i in $(ls_r /media/cdrom/boot/rootfs*); do
310 unlzma < $i | (cd / ; cpio -idmu )
311 done
312 fi
313 cp /tmp/fs/etc/* /etc
314 echo "/home=$(getuuid)/slitaz" > /cmdline
315 [ -x /init1 ] || return
316 umount -d /media/cdrom
317 umount /mnt/slitaz
318 rm -f /dev/cdrom
319 umount /mnt
320 mkdir /mnt/dos
321 umount_proc
322 exec /init1
323 }
325 tazboot()
326 {
327 $DIALOG --clear \
328 --title " SliTaz bootloader for DOS " \
329 --yes-label "Install" --yesno \
330 "\nThe file TAZBOOT.EXE will be created in the top directory. It supports
331 a bzImage linux kernel, multiple initramfs, a kernel command line and
332 an ISO image file loopback (retrieves files from an ISO file).\n\n
333 Usage: tazboot.exe [[@commands]|[kernel=<bzimage>]
334 [initrd=<rootfs>[,<rootfs2>...]] [iso=<isofile>] cmdline args ...]\n\n
335 Defaults: tazboot @tazboot.cmd or tazboot kernel=bzImage auto\n\n\
336 Examples for tazboot.cmd:\n\n\
337 iso=\\isos\\slitaz-4.0.iso\n\
338 kernel=boot/bzImage\n\
339 initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz\n\
340 rw root=/dev/null autologin\n\n\
341 kernel=\\slitaz\\vmlinuz root=/dev/sda5 ro\n\n
342 Unlike GRUB4DOS, it doesn't require unfragmented ISO image files.\n
343 " 24 78
344 [ $? -eq 0 ] || return
345 gettazboot /mnt/tazboot.exe
346 }
348 md5()
349 {
350 echo "Checking files..."
351 ( cd /media/cdrom ; md5sum -c md5sum ) > /tmp/data
352 $DIALOG --clear \
353 --title " Checked files " \
354 --textbox /tmp/data 24 78
355 rm -f /tmp/data
356 }
358 readme()
359 {
360 $DIALOG --clear \
361 --title " Readme " \
362 --textbox /media/cdrom/README 24 78
363 }
365 bootlog()
366 {
367 $DIALOG --clear \
368 --title " Linux boot messages " \
369 --textbox /tmp/dmesg 24 78
370 }
372 memtest()
373 {
374 $DIALOG --clear \
375 --title " Memtest86 " \
376 --yes-label "Install" --yesno \
377 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
378 computers. BIOS based memory tests are a quick, cursory check and often
379 miss many of the failures that are detected by Memtest86.\n
380 " 12 70
381 [ $? -eq 0 ] || return
382 cp /media/cdrom/boot/memtest /mnt/memtest.exe
383 }
385 fdmemtest()
386 {
387 $DIALOG --clear \
388 --title " Create a Memtest86 boot floppy " \
389 --yes-label "Create floppy" --yesno \
390 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
391 computers. BIOS based memory tests are a quick, cursory check and often
392 miss many of the failures that are detected by Memtest86.\n\n
393 Please insert a blank disk in floppy drive.\n
394 " 12 70
395 [ $? -eq 0 ] || return
396 dd if=/media/cdrom/boot/memtest of=/dev/fd0
397 }
399 pxe()
400 {
401 $DIALOG --clear \
402 --title " SliTaz Web boot " \
403 --yes-label "Install" --yesno \
404 "\nBoot your operating system from the internet and enjoy a full system
405 working entirely in RAM with speed and stability in mind. The Linux Kernel
406 and the complete SliTaz compressed root filesystem will be loaded into RAM
407 from the Web using PXE and HTTP protocols.\n
408 " 12 70
409 [ $? -eq 0 ] || return
410 pxe=$(ls /media/cdrom/boot/?pxe)
411 cp $pxe /mnt/$(basename $pxe).exe
412 }
414 fdpxe()
415 {
416 $DIALOG --clear \
417 --title " Create a SliTaz Web boot floppy " \
418 --yes-label "Create floppy" --yesno \
419 "\nBoot your operating system from the internet and enjoy a full system
420 working entirely in RAM with speed and stability in mind. The Linux Kernel
421 and the complete SliTaz compressed root filesystem will be loaded into RAM
422 from the Web using PXE and HTTP protocols.\n\n
423 Please insert a blank disk in floppy drive.\n
424 " 12 70
425 [ $? -eq 0 ] || return
426 dd if=/media/cdrom/boot/?pxe of=/dev/fd0
427 }
429 gotposixovl()
430 {
431 mount.posixovl 2>&1 | grep -qi usage &&
432 echo -en "\"$1\" \"$2\""
433 }
435 xfile()
436 {
437 [ -n "$(which $1)" ] && echo -en "\"$2\" \"$3\""
438 }
440 cdfile()
441 {
442 [ -s /media/cdrom/$1 ] && echo -en "\"$2\" \"$3\""
443 }
445 cdexe()
446 {
447 [ $(get 0 /media/cdrom/$1 2> /dev/null || echo 0) -eq 23117 ] &&
448 echo -en "\"$2\" \"$3\""
449 }
451 fddata()
452 {
453 [ $(get 28 /mnt/$ISO 1 2> /dev/null || echo 0) -ne 0 ] &&
454 echo -en "\"$1\" \"$2\""
455 }
457 fdbootstrap()
458 {
459 sz=$((512 * $(echo $(get 28 /mnt/$ISO 1))))
460 $DIALOG --clear \
461 --title " Create a floppy bootstrap " \
462 --yes-label "Continue" --yesno \
463 "\nThe floppy will install a driver to access the ISO file
464 on your hard disk and will emulate a CD-ROM during the boot process.\n\n
465 Please insert a floppy in drive now.\n
466 " 10 70
467 [ $? -eq 0 ] || return
468 dd if=/mnt/$ISO of=/dev/fd0 bs=1 count=512 \
469 skip=$(( $(get 66 /mnt/$ISO) - $sz ))
470 echo "$ISO" | dd of=/dev/fd0 bs=512 seek=1 count=1
471 dd if=/mnt/$ISO of=/dev/fd0 bs=1 count=$sz seek=2 \
472 skip=$(( $(get 66 /mnt/$ISO) - $sz + 512 ))
473 }
475 usbdev()
476 {
477 sleep 5
478 DEV="$(grep -l 1 /sys/block/*/removable | \
479 sed 's|/sys/block/\(.*\)/removable|\1|')"
480 [ -n "$DEV" ] || return
481 exec 3>&1
482 device=`$DIALOG --clear \
483 --title " Select your USB key " \
484 --menu "\nPlease select the USB key according to its known size.\n\n" \
485 14 70 4 \
486 $(for i in $DEV ; do
487 echo "/dev/$i $(( $(cat /sys/block/$i/size) / 1024 ))MB"
488 done) \
489 2>&1 1>&3`
490 retval=$?
491 exec 3>&-
492 [ $retval -eq 0 ]
493 }
495 usbbootkey()
496 {
497 $DIALOG --clear \
498 --title " Create a USB boot key " \
499 --yes-label "Continue" --yesno \
500 "\nThe USB key will be used like a CD-ROM. You will not be able to write
501 any data on it.\n\n
502 You should choose 'USB key read/write installation' to be
503 able to save the package updates or your own configuration and data files.\n\n
504 Please plug your USB stick in now.\n
505 " 13 70
506 [ $? -eq 0 ] || return
507 usbdev || return
508 dd if=/mnt/$ISO of=$device
509 }
511 usbkey()
512 {
513 $DIALOG --clear \
514 --title " Create a SliTaz USB key " \
515 --yes-label "Continue" --yesno \
516 "\nUnlike a hard drive install, the filesystem is kept in a compressed
517 rootfs.gz. The filesystem is loaded entirely into memory upon boot.
518 This should increase responsiveness, protect the filesystem against
519 accidental corruption and reduce read/writes to the USB drive.
520 Once setup, the tazusb utility can rewrite the root filesystem
521 with any changes you have made since booting up,
522 giving the effective benefits of a hard drive install.\n\n
523 /home is mounted on boot using the UUID of your particular flash drive.
524 Unlike a device name, the UUID has the benefit of never changing from machine
525 to machine.\n\n
526 Please plug your USB stick in now.\n
527 " 19 70
528 [ $? -eq 0 ] || return
529 usbdev || return
530 exec 3>&1
531 format=`$DIALOG --clear \
532 --title " Select the filesystem " \
533 --radiolist "\nPlease select the filesystem type to create.\n\n\
534 The filesystem creation will erase all the data \
535 in the USB key." 14 70 4 \
536 "none" "Do not erase the USB key" on \
537 "ext3" "Ext3 journaling filesystem" off \
538 "ext2" "Ext2 filesystem" off \
539 "fat32" "Windows FAT32 filesystem" off \
540 2>&1 1>&3`
541 retval=$?
542 exec 3>&-
543 [ $retval -eq 0 ] || return
544 [ "$format" != "none" ] && tazusb format $device "SliTaz" $format
545 tazusb gen-iso2usb /mnt/$ISO $device
546 }
548 mount_loram()
549 {
550 is_loram || return
551 insmod /lib/squashfs.ko* 2> /dev/null
552 if [ -d /media/cdrom/fs ]; then
553 ln -s /media/cdrom/fs /sqfs
554 else
555 mkdir /sqfs
556 mount -o loop,ro -t squashfs /rootfs*.gz /sqfs
557 fi
558 ln -s /sqfs/lib/* lib
559 ln -s /sqfs/usr /sqfs/var /
560 for i in dmesg basename tr od reboot poweroff getty sync ; do
561 ln -s /sqfs/bin/busybox /bin/$i
562 done
563 }
565 umount_loram()
566 {
567 is_loram || return
568 rm /var /usr
569 umount -d /sqfs
570 rmdir /sqfs
571 }
573 text()
574 {
575 umount_loram
576 umount -d /media/cdrom
577 rm -f /dev/cdrom
578 umount /mnt
579 umount_proc
580 exec /init
581 }
583 live()
584 {
585 n=0
586 for i in $(ls_r /media/cdrom/boot/rootfs* 2> /dev/null); do
587 [ $((n++)) -eq 0 ] || uncpio $i
588 done
589 text
590 }
592 restart()
593 {
594 sync
595 [ ! -L /sqfs ] && umount -d /media/cdrom && umount /mnt
596 reboot -f
597 }
599 stop()
600 {
601 sync
602 [ ! -L /sqfs ] && umount -d /media/cdrom && umount /mnt
603 poweroff -f
604 }
606 shell()
607 {
608 getty -n -l /bin/ash 38400 tty1 || sh
609 }
611 BIN=bin/mount.posixovl
612 [ -x /usr/s$BIN ] || mv /bin/mount.posixovl.iso2exe \
613 /usr/s$BIN 2> /dev/null || mv /bin/mount.posixovl.iso2exe /$BIN
614 mount_proc
615 ISO="$(getarg iso | sed 's/.://;s|\\|/|g')"
616 getiso
617 mount_loram
618 case "${ISO##*/}$(getarg mode)" in
619 *install*|*INSTALL*) install ;;
620 *live*|*LIVE*) live ;;
621 *text*|*TEXT*) text ;;
622 esac
623 which $DIALOG 2> /dev/null || live
624 dmesg > /tmp/dmesg
626 while true; do
627 keymap="$(cat /etc/keymap.conf 2> /dev/null)"
628 locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2> /dev/null)"
629 cat > /tmp/dialog <<EOT
630 $DIALOG --clear \
631 --title " Welcome to SliTaz " \
632 --menu "" 21 70 15 \
633 $(xfile tazkeymap "tazkeymap" "Select keyboard ($keymap)") \
634 $(xfile tazlocale "tazlocale" "Select locale ($locale)") \
635 $(cdfile boot/bzImage "live" "SliTaz RAM boot") \
636 "text" "SliTaz RAM boot (text mode only)" \
637 $(cdfile README "readme" "Show the README file") \
638 $(cdfile md5sum "md5" "Check ISO files") \
639 $(gotposixovl "install" "Hard disk installation (UMSDOS way)") \
640 $(gotposixovl "installtaz" "Hard disk installation (TAZUSB way)") \
641 $(xfile tazusb "usbkey" "USB key read/write installation") \
642 $(cdfile boot/bzImage "usbbootkey" "USB boot key (read only)") \
643 $(fddata "fdbootstrap" "Floppy bootstrap") \
644 $(cdfile boot/bzImage "tazboot" "Get tazboot.exe Linux loader") \
645 $(cdexe boot/memtest "memtest" "Get Memtest86") \
646 $(cdfile boot/memtest "fdmemtest" "Create a Memtest86 boot floppy") \
647 $(cdexe boot/gpxe "pxe" "Get SliTaz Web boot utility") \
648 $(cdfile boot/gpxe "fdpxe" "Create a SliTaz Web boot floppy") \
649 $(cdexe boot/ipxe "pxe" "Get SliTaz Web boot utility") \
650 $(cdfile boot/ipxe "fdpxe" "Create a SliTaz Web boot floppy") \
651 $(xfile reboot "restart" "Restart the computer") \
652 $(xfile poweroff "stop" "Power off") \
653 "bootlog" "Linux boot messages" \
654 "shell" "Shell prompt" \
656 EOT
657 exec 3>&1
658 value=$(sh /tmp/dialog 2>&1 1>&3)
659 retval=$?
660 exec 3>&-
661 [ $retval -eq 0 ] || continue
662 $value
663 done