wok annotate syslinux/stuff/iso2exe/init @ rev 21801

linld/iso2exe: remove non slitaz dos boot
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Aug 10 18:47:30 2019 +0200 (2 months ago)
parents 04ffefac5707
children 2ca609c01117
rev   line source
pascal@21302 1 #!/bin/sh
pascal@13691 2
pascal@13691 3 DIALOG=dialog
pascal@13691 4
pascal@17454 5 ddq()
pascal@17454 6 {
pascal@21801 7 dd $@ 2>/dev/null
pascal@17454 8 }
pascal@17454 9
pascal@13691 10 get()
pascal@13691 11 {
pascal@17496 12 od -v -j $1 -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} -An $2 2>/dev/null ||
pascal@21460 13 hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" $2
pascal@13691 14 }
pascal@13691 15
pascal@13691 16 getarg()
pascal@13691 17 {
pascal@13691 18 sed "/$1=/!d;s/.*$1=\\([^ ]*\\).*/\\1/" /proc/cmdline
pascal@13691 19 }
pascal@13691 20
pascal@17489 21 clear()
pascal@17489 22 {
pascal@17489 23 echo -e "\x1B[1;1H\x1B[J"
pascal@17489 24 }
pascal@17489 25
pascal@17569 26 xless()
pascal@17569 27 {
pascal@17569 28 [ $(wc -l < "$1") -gt 22 ] &&
pascal@17569 29 sed 's/..3.;4.m/===/g;$s/.*/&\n---\nPress q to continue/' "$1" | less ||
pascal@17569 30 { cat "$1"
pascal@17569 31 [ "$2" ] || return
pascal@17569 32 echo -e "$2"
pascal@17569 33 read n
pascal@17569 34 }
pascal@17569 35 }
pascal@17569 36
pascal@17489 37 tinydialog()
pascal@17489 38 {
pascal@17489 39 clear
pascal@17489 40 label=""
pascal@17489 41 while [ "$1" ]; do
pascal@17489 42 case "$1" in
pascal@17489 43 --title) title=" \x1B[30;47m$2\x1B[37;40m\n"
pascal@21801 44 echo -e $title; shift;;
pascal@21801 45 --yes-label) label="$2"; shift;;
pascal@17489 46 --textbox)
pascal@17569 47 xless "$2" "\nPress RETURN to continue."
pascal@17489 48 break;;
pascal@17489 49 --gauge)
pascal@17489 50 t=" "
pascal@17489 51 echo -e "$t$2\n"
pascal@21801 52 while read pct; do
pascal@17489 53 s=" "
pascal@17489 54 s="$s$pct%$s"
pascal@17489 55 pct=$((($pct*63)/100))
pascal@17489 56 echo -en "\r$t\x1B[30;47m$(echo "$s" | cut -c-$pct)\x1B[37;40m$(echo "$s" | cut -c$(($pct+1))-)"
pascal@17489 57 done
pascal@17489 58 break;;
pascal@17489 59 --yesno)
pascal@17489 60 while true; do
pascal@17489 61 clear
pascal@17491 62 echo "$2" | sed 's/\\n\\n/\\n/g;s/\\n/\n/g'
pascal@17491 63 echo -en " <- 1:${label:-Yes} 2:Cancel\r"
pascal@17489 64 read x
pascal@17489 65 case "$x" in
pascal@17489 66 ''|Y*|y*|1) return 0;;
pascal@17489 67 N*|n*|2|0) return 1;;
pascal@17489 68 esac
pascal@21801 69 done;;
pascal@17489 70 --menu|--radiolist)
pascal@20891 71 [ "$1" = "--menu" ] && shft=2 || shft=3
pascal@17491 72 label=""
pascal@20771 73 [ "$2" ] && label="\n$2"
pascal@17489 74 shift 5
pascal@17491 75 echo -e "$title$label\n0 Cancel" > /tmp/data
pascal@17489 76 n=1
pascal@17489 77 while [ "$1" ]; do
pascal@17489 78 eval key_$n='$1'
pascal@17489 79 echo "$((n++)) $2"
pascal@17491 80 shift $shft
pascal@17489 81 done >> /tmp/data
pascal@21801 82 while ! grep -q "^$n " /tmp/data; do
pascal@17489 83 clear
pascal@17569 84 xless /tmp/data
pascal@17489 85 echo -en "\n <- Enter the selection number\r"
pascal@17489 86 read n
pascal@21801 87 done 2>/dev/null
pascal@17489 88 rm -f /tmp/data
pascal@17489 89 [ $n -eq 0 ] && return 1
pascal@17489 90 eval echo -n \$key_$n 1>&2
pascal@17489 91 return 0;;
pascal@17489 92 esac
pascal@17489 93 shift
pascal@17489 94 done
pascal@17489 95 }
pascal@17489 96
pascal@16041 97 mount_proc()
pascal@16041 98 {
pascal@16041 99 mount -t proc /proc /proc
pascal@16041 100 mount -t sysfs /sys /sys
pascal@21801 101 udevd --daemon 2>/dev/null && udevadm trigger && sleep 5
pascal@16041 102 }
pascal@16041 103
pascal@16041 104 umount_proc()
pascal@16041 105 {
pascal@21801 106 killall udevd 2>/dev/null
pascal@21801 107 umount /sys/fs/fuse/connections 2>/dev/null
pascal@16041 108 umount /sys
pascal@16041 109 umount /proc
pascal@16041 110 }
pascal@16041 111
pascal@17473 112 bytes2bin()
pascal@17473 113 {
pascal@21801 114 for i in $@; do
pascal@17569 115 printf '\\\\x%02X' $(($i&255))
pascal@17569 116 done | xargs echo -en
pascal@17473 117 }
pascal@17473 118
pascal@17454 119 words2bin()
pascal@17454 120 {
pascal@21801 121 for i in $@; do
pascal@17569 122 printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255))
pascal@17569 123 done | xargs echo -en
pascal@17454 124 }
pascal@17454 125
pascal@13691 126 gettazboot()
pascal@13691 127 {
pascal@21506 128 echo -e "\nCreating $(basename $1) ..."
pascal@21472 129 X=$(($(get 20 /mnt/$ISO) - 0xC0))
pascal@21472 130 [ $X -lt 30000 ] && X=$((0x7FF0))
pascal@17810 131 O=$(($(get 64 /mnt/$ISO) - 0xC0))
pascal@21472 132 L=$(($X - $(get 24 /mnt/$ISO) - $O))
pascal@13691 133 S=$((32+$L))
pascal@13691 134 P=$((($S+511)/512))
pascal@13691 135 E=$((4096-(32*$P)))
pascal@17454 136 words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 $((${2:-0}-16)) \
pascal@17454 137 -2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1
pascal@21472 138 ddq bs=1 count=$(echo $L) skip=$(echo $O) if=/mnt/$ISO >> $1
pascal@13691 139 }
pascal@13691 140
pascal@13691 141 checkmagic()
pascal@13691 142 {
pascal@20891 143 [ -s $1 ] && [ $(getarg magic) = $(get 18 $1 2) ]
pascal@13691 144 }
pascal@13691 145
pascal@13691 146 getiso()
pascal@13691 147 {
pascal@13713 148 mkdir -p /media/cdrom
pascal@21801 149 for dev in /sys/block/?d?/?d??*; do
pascal@17489 150 mount /dev/$(basename $dev) /mnt
pascal@13713 151 if checkmagic /mnt/$ISO; then
pascal@13713 152 mount -o loop,ro /mnt/$ISO /media/cdrom
pascal@17489 153 echo "Found $ISO on $(basename $dev)"
pascal@19510 154 return 0
pascal@13713 155 fi
pascal@13713 156 umount /mnt
pascal@21801 157 done 2>/dev/null
pascal@19510 158 return 1
pascal@13691 159 }
pascal@13691 160
pascal@13691 161 uncpio()
pascal@13691 162 {
pascal@21801 163 i=$1
pascal@21801 164 grep -q ' lm ' /proc/cpuinfo && [ -s ${i}64 ] && i=${i}64
pascal@21801 165 [ -s "$i" ] || return
pascal@21801 166 echo -en "\n Extracting $(basename $i) ..."
pascal@21801 167 case $(get 0 $i) in
pascal@21801 168 *35615) ( zcat || gunzip );;
pascal@21801 169 *14333) unxz;;
pascal@21801 170 *\ 93) unlzma;;
pascal@21801 171 *) cat;;
pascal@21801 172 esac < $i | ( cd ${2:-/}; cpio -idmu > /dev/null 2>&1 )
pascal@13691 173 }
pascal@13691 174
pascal@17476 175 dotwait()
pascal@17476 176 {
pascal@17476 177 echo -n "${1:-Install filesystem}.."
pascal@21363 178 echo -n > /tmp/wait
pascal@17476 179 while [ -e /tmp/wait ]; do
pascal@17476 180 echo -n "." > /dev/tty0
pascal@17476 181 sleep 1
pascal@17476 182 done &
pascal@17476 183 }
pascal@17476 184
pascal@13691 185 getuuid()
pascal@13691 186 {
pascal@13691 187 dev=$(mount | sed '/ \/mnt /!d;s/ .*//;s|/dev/||;q')
pascal@16041 188 blkid | sed "/$dev:/!d;s/.* UUID=.\\([^ ]*\\)\".*/\\1/"
pascal@13691 189 }
pascal@13691 190
pascal@16055 191 tazusbinitfs()
pascal@16055 192 {
pascal@16055 193 PAD=$(($(stat -c %s $1) % 4))
pascal@17454 194 [ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1
pascal@16055 195 mkdir -p /tmp/fs/etc /tmp/fs/lib /tmp/fs/home
pascal@21801 196 cp /etc/keymap.conf /etc/locale.conf /tmp/fs/etc 2>/dev/null
pascal@16055 197 cat > /tmp/fs/init1 <<EOT
pascal@16055 198 #!/bin/sh
pascal@16055 199 sed -i 's|sbin/init|init2|' /init
pascal@16055 200 exec /init
pascal@16055 201 EOT
pascal@16055 202 cat > /tmp/fs/init2 <<EOT
pascal@16055 203 #!/bin/sh
pascal@16055 204
pascal@16055 205 mount -t proc /proc /proc
pascal@21801 206 for i in /lib/modules/*.ko*; do insmod \$i 2>/dev/null; done; sleep 2
pascal@21801 207 v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2>/dev/null)
pascal@16055 208 mount / -o remount,rw
pascal@16055 209 mkdir /mnt/dos
pascal@21801 210 rm -f /cmdline 2>/dev/null
pascal@16055 211 mount / -o remount,ro
pascal@16055 212 mnt=/mnt/dos/\${v#*/}
pascal@16055 213 dev=\$( (blkid /dev/[sh]d* || blkid) | grep \${v%%/*} | sed 's/:.*//;q')
pascal@16055 214 echo "Mount \$dev in /mnt/dos for \$v..." | tee -a /run/boot.log
pascal@16055 215 mount \$dev /mnt/dos
pascal@16055 216 mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
pascal@16055 217 mount --bind \$mnt /home
pascal@21506 218 mount -o size=0,ro -t tmpfs tmpfs \$mnt
pascal@16055 219 umount /proc
pascal@16055 220 exec /sbin/init
pascal@16055 221 EOT
pascal@16055 222 chmod 755 /tmp/fs/init?
pascal@16055 223 cp -a /tmp/fs/* /
pascal@21801 224 ln -s /sqfs/bin/gzip /bin 2>/dev/null
pascal@21801 225 ( cd /tmp/fs; find * | cpio -o -H newc ) | gzip -9 >> $1
pascal@16055 226 }
pascal@16055 227
pascal@13691 228 mkinitrd()
pascal@13691 229 {
pascal@21472 230 echo
pascal@17476 231 dotwait "Creating $(basename $1) "
pascal@21801 232 for i in bin lib dev proc tmp mnt etc; do
pascal@13691 233 mkdir -p /tmp/fs/$i
pascal@13691 234 done
pascal@21801 235 for i in /dev/console /dev/null /dev/tty /dev/tty[012] /dev/fuse /dev/[hs]d*; do
pascal@13691 236 cp -a $i /tmp/fs$i
pascal@13691 237 done
pascal@13713 238 for i in /bin/busybox $(which mount.posixovl) $(which blkid); do
pascal@13691 239 cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $i | \
pascal@13691 240 sed 's|.*=> \(.*/lib/l[^ ]*\).*|\1|;/^\//!d') /tmp/fs/lib
pascal@13691 241 cp $i /tmp/fs/bin
pascal@13691 242 done
pascal@21801 243 cp -a /sqfs/lib/ld-* /tmp/fs/lib 2>/dev/null ||
pascal@13691 244 cp -a /lib/ld-* /tmp/fs/lib
pascal@13691 245 for i in $(busybox | sed '/Current/,$!d'); do
pascal@14271 246 [ -e /tmp/fs/bin/${i%,} ] || ln -s busybox /tmp/fs/bin/${i%,}
pascal@13691 247 done
pascal@13691 248 ln -s /proc/mounts /tmp/fs/etc/mtab
pascal@21801 249 sed 's/ .*//' /proc/modules | while read mod; do
pascal@16041 250 find /lib/modules/ | grep $mod.ko | \
pascal@16041 251 sed 's|.*|cp & /tmp/fs/lib|' | sh
pascal@16041 252 done
pascal@13691 253 cat > /tmp/fs/init <<EOT
pascal@13691 254 #!/bin/sh
pascal@13691 255
pascal@13691 256 arg()
pascal@13691 257 {
pascal@13691 258 grep -q \$1 /proc/cmdline &&
pascal@13691 259 val="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" < /proc/cmdline)" &&
pascal@13691 260 echo "\$2 \$val"
pascal@13691 261 }
pascal@13691 262
pascal@13691 263 mount -t proc /proc /proc
pascal@21801 264 for i in /lib/*.ko*; do insmod \$i 2>/dev/null; done; sleep 2
pascal@13691 265 arg mount "Mount device"
pascal@16055 266 mount \$( (blkid /dev/[sh]d* || blkid) | grep \$val | sed 's/:.*//;q') /mnt
pascal@13691 267 arg subroot "Change root to directory"
pascal@16041 268 mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
pascal@13691 269 mount --bind /mnt /mnt/\$val/mnt/dos
pascal@21472 270 mount -o size=0,ro -t tmpfs tmpfs /mnt/\$val/mnt/dos/\$val
pascal@13691 271 LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
pascal@16041 272 export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
pascal@13691 273 umount /proc
pascal@13691 274 exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init
pascal@13691 275 EOT
pascal@13691 276 chmod +x /tmp/fs/init
pascal@21801 277 ( cd /tmp/fs; find * | cpio -o -H newc ) | lzma e $1 -si 2>/dev/null
pascal@17476 278 rm -rf /tmp/fs /tmp/wait
pascal@13691 279 }
pascal@13691 280
pascal@13713 281 is_loram()
pascal@13713 282 {
pascal@21459 283 [ -s /lib/modules/squashfs.ko* ]
pascal@13713 284 }
pascal@13713 285
pascal@16041 286 ls_r()
pascal@16041 287 {
pascal@21801 288 ls -r $@ 2>/dev/null || ls $@
pascal@16041 289 }
pascal@16041 290
pascal@13691 291 doinstall()
pascal@13691 292 {
pascal@14271 293 mkdir -p /mnt/slitaz/boot /mnt/slitaz/mnt/dos
pascal@16041 294 if ! mount.posixovl -F /mnt/slitaz -- \
pascal@16041 295 -oallow_other -odefault_permissions -osuid; then
pascal@16041 296 echo "Can't install SliTaz. Abort."
pascal@16041 297 sleep 5
pascal@16041 298 return 1
pascal@16041 299 fi
pascal@17635 300 dotwait "Install root filesystem in /slitaz.."
pascal@17454 301 if [ "$1" ]; then
pascal@14271 302 if [ -d /media/cdrom/fs ]; then
pascal@14271 303 ( cd /mnt/slitaz/fs; find | cpio -o -H newc ) | gzip -9
pascal@14271 304 else
pascal@21801 305 ls_r /media/cdrom/boot/rootfs* | xargs cat
pascal@14271 306 fi > /mnt/slitaz/boot/rootfs.gz
pascal@16055 307 tazusbinitfs /mnt/slitaz/boot/rootfs.gz
pascal@14271 308 initrd=rootfs.gz
pascal@16055 309 extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
pascal@13713 310 else
pascal@14271 311 if [ -d /media/cdrom/fs ]; then
pascal@14271 312 cp -a /media/cdrom/fs/. /mnt/slitaz
pascal@21801 313 elif is_loram; then
pascal@21801 314 for i in $(ls_r /media/cdrom/boot/rootfs*); do
pascal@21506 315 losetup -o 124 /dev/loop7 $i
pascal@21506 316 mount -t squashfs -o ro /dev/loop7 /sqfs/mnt
pascal@14271 317 cp -a /sqfs/mnt/. /mnt/slitaz
pascal@21506 318 umount /sqfs/mnt
pascal@21506 319 losetup -d /dev/loop7
pascal@14271 320 done
pascal@14271 321 else
pascal@21801 322 for i in $(ls_r /media/cdrom/boot/rootfs*); do
pascal@14271 323 uncpio $i /mnt/slitaz
pascal@14271 324 done
pascal@14271 325 fi
pascal@14271 326 mkinitrd /mnt/slitaz/boot/initrd
pascal@14271 327 initrd=initrd
pascal@14271 328 extraargs="mount=$(getuuid) subroot=slitaz"
pascal@13713 329 fi
pascal@17476 330 echo -en "\nInstall boot files..."
pascal@13691 331 for i in /media/cdrom/boot/bzImage /media/cdrom/boot/*pxe* \
pascal@13691 332 /media/cdrom/boot/isolinux/he* /media/cdrom/boot/isolinux/opt* \
pascal@21801 333 /media/cdrom/README /media/cdrom/boot/memtest*; do
pascal@13691 334 [ -s $i ] && cp $i /mnt/slitaz/boot
pascal@13691 335 done
pascal@21801 336 for i in /mnt/slitaz/boot/memtest /mnt/slitaz/boot/*pxe; do
pascal@21801 337 [ $(get 0 $i 2>/dev/null || echo 0) -eq 23117 ] &&
pascal@16047 338 mv $i $i.exe
pascal@16047 339 done
pascal@21801 340 cp /etc/keymap.conf /etc/locale.conf /mnt/slitaz/etc 2>/dev/null
pascal@13691 341 gettazboot /mnt/slitaz/boot/tazboot.exe
pascal@14247 342 unix2dos > /mnt/slitaz/boot/tazboot.cmd <<EOT
pascal@16041 343 kernel=/slitaz/boot/bzimage
pascal@16041 344 initrd=/slitaz/boot/$initrd
pascal@14271 345 rw root=/dev/null $extraargs autologin
pascal@13691 346 EOT
pascal@21553 347 uudecode - <<EOT | gunzip > /mnt/slitaz/boot/slitaz.pif
pascal@21553 348 begin-base64 644 -
pascal@21553 349 H4sIAAAAAAACA8XPxUHGMBTA8X9ecb/glgFwv+FO23zeI+7ucMFhCjZgEEZh
pascal@21553 350 Ctzd4Rf3PFbtQHGLG9BmfmZqdlE/tSmw2LfePzOzWDK0OsQXpPHvFGfZBmL5
pascal@21553 351 f3Zns98NuG1BbTrbWj0OFMypSKfT4kYCurKuRleWlBEth2qUTYFBKjg746pI
pascal@21553 352 2nZaIT/v9vWwbeuqi9fPznLlSPFLLuK22/0lLT09/BDhXgWKO1f9aLKxOObE
pascal@21553 353 EhLuVvO4FksSwaH5qbHpvkle0TyzND82NK+doRVeZgGGbIw0XD2QwV9SnAN/
pascal@21553 354 ACxDxwMAAA==
pascal@21553 355 ====
pascal@21553 356 EOT
pascal@13691 357 unix2dos /mnt/slitaz/boot/he* /mnt/slitaz/boot/opt* \
pascal@14247 358 /mnt/slitaz/boot/README
pascal@14271 359 [ -d /mnt/slitaz/usr/sbin -a ! -x /mnt/slitaz/usr/sbin/mount.posixovl ] &&
pascal@13713 360 cp $(which mount.posixovl) /mnt/slitaz/usr/sbin
pascal@17476 361 rm -f /tmp/wait
pascal@16041 362 false &&
pascal@17476 363 [ -s /mnt/boot.ini ] && ! grep -qs tazboot /mnt/boot.ini &&
pascal@17476 364 echo "Update boot.ini ..." && unix2dos >> /mnt/boot.ini <<EOT
pascal@13691 365 C:\\slitaz\\boot\\tazboot.exe="SliTaz"
pascal@13691 366 EOT
pascal@16073 367 false &&
pascal@16073 368 grep -qis menuitem /mnt/config.sys && ! grep -qi tazboot /mnt/config.sys &&
pascal@16041 369 echo "Update config.sys ..." &&
pascal@16073 370 sed -i 's/menudefault/menuitem SLITAZ, SliTaz\r\n&/' /mnt/config.sys &&
pascal@16073 371 unix2dos >> /mnt/config.sys <<EOT
pascal@16073 372 [SLITAZ]
pascal@16073 373 install=\\slitaz\\boot\\tazboot.exe
pascal@13691 374 EOT
pascal@16041 375 return 0
pascal@13691 376 }
pascal@13691 377
pascal@13691 378 install()
pascal@13691 379 {
pascal@20771 380 $DIALOG --clear --title " SliTaz UMSDOS way installation " \
pascal@13691 381 --yes-label "Install" --yesno \
pascal@13691 382 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
pascal@13691 383 DOS/Windows partition. You will see your files from /mnt/dos.\n\n
paul@13692 384 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
pascal@13691 385 To uninstall SliTaz, you have only to remove this directory.
pascal@13691 386 The file \\boot.ini or \\config.sys may be modified too.\n\n
pascal@20771 387 SliTaz may run slowly on the 'UMSDOS way' installation due to the
paul@14320 388 posixovl filesystem. The 'TAZUSB way' installation runs faster.\n\n
pascal@13697 389 To do a traditional installation with disk partitioning,
pascal@20771 390 start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
pascal@14271 391 [ $? -eq 0 ] || return
pascal@16041 392 doinstall || return
pascal@16041 393 [ -x /mnt/slitaz/sbin/init ] || return
pascal@14271 394 umount -d /media/cdrom
pascal@16041 395 umount_proc
pascal@13691 396 exec chroot /mnt/slitaz /sbin/init
pascal@13691 397 }
pascal@13691 398
pascal@14271 399 installtaz()
pascal@14271 400 {
pascal@20771 401 $DIALOG --clear --title " SliTaz TAZUSB way installation " \
pascal@14271 402 --yes-label "Install" --yesno \
pascal@14271 403 "\nSliTaz will be installed in the subdirectory \\slitaz of the current
pascal@14271 404 DOS/Windows partition. You will see your files from /mnt/dos.\n\n
pascal@14271 405 You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
pascal@14271 406 To uninstall SliTaz, you have only to remove this directory.
pascal@14271 407 The file \\boot.ini or \\config.sys may be modified too.\n\n
pascal@14271 408 The filesystem is loaded entirely into memory upon boot to
paul@19451 409 increase responsiveness. Only /home lands on the hard disk.\n\n
pascal@14271 410 To do a traditional installation with disk partitioning,
pascal@20771 411 start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
pascal@14271 412 [ $? -eq 0 ] || return
pascal@16041 413 doinstall tazusblike || return
pascal@20771 414 dotwait
pascal@14271 415 if [ -d /media/cdrom/fs ]; then
pascal@16055 416 cp -a /media/cdrom/fs/. /
pascal@14271 417 else
pascal@21801 418 for i in $(ls_r /media/cdrom/boot/rootfs*); do
pascal@17454 419 uncpio $i
pascal@14271 420 done
pascal@14271 421 fi
pascal@21801 422 cp /tmp/fs/etc/* /etc 2>/dev/null
pascal@16055 423 echo "/home=$(getuuid)/slitaz" > /cmdline
pascal@17476 424 rm -f /tmp/wait
pascal@16055 425 [ -x /init1 ] || return
pascal@14271 426 umount -d /media/cdrom
pascal@16055 427 umount /mnt/slitaz
pascal@16073 428 rm -f /dev/cdrom
pascal@16055 429 umount /mnt
pascal@16055 430 mkdir /mnt/dos
pascal@16041 431 umount_proc
pascal@16055 432 exec /init1
pascal@14271 433 }
pascal@14271 434
pascal@13691 435 tazboot()
pascal@13691 436 {
pascal@20771 437 $DIALOG --clear --title " SliTaz bootloader for DOS " \
pascal@13691 438 --yes-label "Install" --yesno \
paul@13692 439 "\nThe file TAZBOOT.EXE will be created in the top directory. It supports
pascal@17476 440 any linux kernel, multiple initramfs, a kernel command line and
paul@13692 441 an ISO image file loopback (retrieves files from an ISO file).\n\n
pascal@20771 442 Usage: tazboot.exe [[@commands]|[kernel=<bzimage>]
pascal@17489 443 [initrd=<rootfs>[,<rootfs2>...]] [bootfrom=<isofile>] cmdline args ...]\n\n
paul@13692 444 Defaults: tazboot @tazboot.cmd or tazboot kernel=bzImage auto\n\n\
pascal@13691 445 Examples for tazboot.cmd:\n\n\
pascal@17489 446 bootfrom=\\isos\\slitaz-4.0.iso\n\
pascal@13691 447 kernel=boot/bzImage\n\
pascal@13691 448 initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz\n\
pascal@13691 449 rw root=/dev/null autologin\n\n\
pascal@13691 450 kernel=\\slitaz\\vmlinuz root=/dev/sda5 ro\n\n
pascal@20771 451 Unlike GRUB4DOS, it doesn't require unfragmented ISO image files.\n" 24 78
pascal@13691 452 [ $? -eq 0 ] || return
pascal@13691 453 gettazboot /mnt/tazboot.exe
pascal@13691 454 }
pascal@13691 455
pascal@13697 456 md5()
pascal@13697 457 {
pascal@17476 458 dotwait "Checking files"
pascal@21801 459 ( cd /media/cdrom; ${1:-md5sum -c md5sum*} | sort ) > /tmp/data
pascal@17476 460 rm -f /tmp/wait
pascal@20771 461 $DIALOG --clear --title " Checked files " --textbox /tmp/data 24 78
pascal@13697 462 rm -f /tmp/data
pascal@13697 463 }
pascal@13697 464
pascal@17491 465 gotcdfile()
pascal@17491 466 {
pascal@17635 467 for i in "/media/cdrom/$1" "/media/cdrom/*/$1" \
pascal@21801 468 "/media/cdrom/*/isolinux/$1"; do
pascal@21801 469 file=$(ls $i 2>/dev/null | sed q)
pascal@17491 470 [ -s "$file" ] && break
pascal@17491 471 done
pascal@17491 472 }
pascal@17491 473
pascal@17489 474 sha()
pascal@17489 475 {
pascal@17635 476 gotcdfile "sha*sum*"
pascal@17489 477 sha=$(basename $file)
pascal@17489 478 md5 "${sha%sum*}sum -c ${file#/media/cdrom/}"
pascal@17489 479 }
pascal@17489 480
pascal@13697 481 readme()
pascal@13697 482 {
pascal@17635 483 gotcdfile "README*"
pascal@20771 484 $DIALOG --clear --title " Readme " --textbox $file 24 78
pascal@13697 485 }
pascal@13697 486
pascal@13697 487 bootlog()
pascal@13697 488 {
pascal@20771 489 $DIALOG --clear --title " Linux boot messages " \
pascal@13697 490 --textbox /tmp/dmesg 24 78
pascal@13697 491 }
pascal@13697 492
pascal@17476 493 bzimage()
pascal@17476 494 {
pascal@20771 495 $DIALOG --clear --title " Create linux.exe ? " \
pascal@17476 496 --yes-label "Install" --yesno \
pascal@17476 497 "\nLinux.exe launches the linux kernel under DOS (in real mode only).
pascal@17569 498 The cmdline arguments are supported except initrd=,
pascal@17569 499 vga= (you can try 'rdev -v') and mem= (partially).
pascal@17569 500 \nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n
pascal@17476 501 " 12 70
pascal@17476 502 [ $? -eq 0 ] || return
pascal@17476 503 cp /media/cdrom/boot/bzImage /mnt/linux.exe
pascal@17476 504 }
pascal@17476 505
pascal@13697 506 memtest()
pascal@13697 507 {
pascal@20771 508 $DIALOG --clear --title " Create memtest.exe ? " \
pascal@13697 509 --yes-label "Install" --yesno \
pascal@13697 510 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
pascal@13697 511 computers. BIOS based memory tests are a quick, cursory check and often
pascal@20771 512 miss many of the failures that are detected by Memtest86.\n" 12 70
pascal@17635 513 [ $? -eq 0 ] && gotcdfile "memtest*" && cp $file /mnt/memtest.exe
pascal@13697 514 }
pascal@13697 515
pascal@17489 516 mkfat12()
pascal@17473 517 {
pascal@17473 518 [ $(($(get 0 $1) - 0x5A4D)) -eq 0 ] || return
pascal@17473 519 J=$(($(get 3 $1 1) + 0x02))
pascal@17473 520 R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
pascal@17473 521 [ $R -lt 2500 ] || return
pascal@17476 522 [ $((($(get 500 $1)-1) & 31)) -lt 30 ] &&
pascal@17474 523 ddq if=$file bs=32 count=1 seek=$(($R*16 - 1)) of=/dev/fd0
pascal@17473 524 G="18 0 2 0 0 0 0 0"
pascal@17473 525 [ $J -gt 25 ] || G=""
pascal@17473 526 F=0
pascal@17473 527 for i in 1 2 3; do
pascal@17473 528 F=$((((2880-$R-$F-$F)*3+1023)/1024))
pascal@17473 529 done
pascal@17473 530 bytes2bin 0xEB $J 0x90 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 \
pascal@17473 531 0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \
pascal@17473 532 $G | ddq bs=1 of=/dev/fd0
pascal@17473 533 ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0
pascal@21801 534 for i in $R $(($R+$F)); do
pascal@17473 535 bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
pascal@17473 536 done
pascal@17473 537 echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
pascal@17489 538 }
pascal@17489 539
pascal@17489 540 mkfloppy()
pascal@17489 541 {
pascal@21485 542 dotwait "Create a $(basename $1 .exe) boot floppy"
pascal@17489 543 ddq if=$1 of=/dev/fd0
pascal@17489 544 mkfat12 $1
pascal@17476 545 rm -f /tmp/wait
pascal@17473 546 }
pascal@17473 547
pascal@13697 548 fdmemtest()
pascal@13697 549 {
pascal@20771 550 $DIALOG --clear --title " Create a Memtest86 boot floppy " \
pascal@13697 551 --yes-label "Create floppy" --yesno \
pascal@13697 552 "\nMemtest86 is a thorough, stand alone memory test for x86 architecture
pascal@13697 553 computers. BIOS based memory tests are a quick, cursory check and often
pascal@13697 554 miss many of the failures that are detected by Memtest86.\n\n
pascal@20771 555 Please insert a blank disk in floppy drive.\n" 12 70
pascal@17635 556 [ $? -eq 0 ] && gotcdfile "memtest*" && mkfloppy $file
pascal@13697 557 }
pascal@13697 558
pascal@16013 559 pxe()
pascal@13697 560 {
pascal@20762 561 gotcdfile "?pxe*"
pascal@21485 562 $DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
pascal@13697 563 --yes-label "Install" --yesno \
pascal@13697 564 "\nBoot your operating system from the internet and enjoy a full system
pascal@13697 565 working entirely in RAM with speed and stability in mind. The Linux Kernel
pascal@13697 566 and the complete SliTaz compressed root filesystem will be loaded into RAM
pascal@20771 567 from the Web using PXE and HTTP protocols.\n" 12 70
pascal@13697 568 [ $? -eq 0 ] || return
pascal@21485 569 cp $file /mnt/$(basename $file .exe).exe
pascal@13697 570 }
pascal@13697 571
pascal@16013 572 fdpxe()
pascal@13697 573 {
pascal@20771 574 $DIALOG --clear --title " Create a SliTaz Web boot floppy " \
pascal@13697 575 --yes-label "Create floppy" --yesno \
pascal@13697 576 "\nBoot your operating system from the internet and enjoy a full system
pascal@13697 577 working entirely in RAM with speed and stability in mind. The Linux Kernel
pascal@13697 578 and the complete SliTaz compressed root filesystem will be loaded into RAM
pascal@13697 579 from the Web using PXE and HTTP protocols.\n\n
pascal@20771 580 Please insert a blank disk in floppy drive.\n" 12 70
pascal@20762 581 [ $? -eq 0 ] && gotcdfile "?pxe*" && mkfloppy $file
pascal@13697 582 }
pascal@13697 583
pascal@16041 584 gotposixovl()
pascal@16041 585 {
pascal@20771 586 mount.posixovl 2>&1 | grep -qi usage &&
pascal@16041 587 echo -en "\"$1\" \"$2\""
pascal@16041 588 }
pascal@16041 589
pascal@14271 590 xfile()
pascal@14271 591 {
pascal@17454 592 [ "$(which $1)" ] && echo -en "\"$2\" \"$3\""
pascal@14271 593 }
pascal@14271 594
pascal@13697 595 cdfile()
pascal@13697 596 {
pascal@17489 597 gotcdfile "$1" && echo -en "\"$2\" \"$3\""
pascal@17476 598 }
pascal@17476 599
pascal@17659 600 isbzImage()
pascal@17659 601 {
pascal@17659 602 [ $(get 514 $file 4) -eq 1400005704 ] &&
pascal@17659 603 [ $(($(get 529 $file 1) & 1)) -eq 1 ]
pascal@17659 604 }
pascal@17659 605
pascal@17476 606 cdfilex()
pascal@17476 607 {
pascal@17659 608 gotcdfile "$1" &&
pascal@17659 609 [ "$(which kexec)" ] &&
pascal@17659 610 isbzImage &&
pascal@17659 611 echo -en "\"$2\" \"$3\""
pascal@14271 612 }
pascal@14271 613
pascal@17491 614 cdfilef()
pascal@17491 615 {
pascal@17491 616 [ -e /sys/block/fd0 ] && cdfile "$@"
pascal@17491 617 }
pascal@17491 618
pascal@16022 619 cdexe()
pascal@16022 620 {
pascal@17489 621 gotcdfile "$1" &&
pascal@17489 622 [ $(get 0 $file 2>/dev/null || echo 0) -eq 23117 ] &&
pascal@16022 623 echo -en "\"$2\" \"$3\""
pascal@16022 624 }
pascal@16022 625
pascal@14271 626 fddata()
pascal@14271 627 {
pascal@20771 628 [ -e /sys/block/fd0 ] &&
pascal@21801 629 [ $(get 26 /mnt/$ISO 1 2>/dev/null || echo 0) -ne 0 ] &&
pascal@14271 630 echo -en "\"$1\" \"$2\""
pascal@13697 631 }
pascal@13697 632
pascal@17491 633 ishybrid()
pascal@17491 634 {
pascal@21801 635 [ $(get 510 $ISO 2>/dev/null || echo 0) -eq 43605 ] || return
pascal@17491 636 C=$((2048*$(get $(((17*2048) + 71)) /mnt/$ISO 4)))
pascal@17491 637 [ $(get $C /mnt/$ISO 4) -eq 1 ] || return
pascal@17491 638 [ $(get $(($C+30)) /mnt/$ISO 4) -eq $((0x88AA55)) ] || return
pascal@17491 639 C=$((2048*$(get $(($C+40)) /mnt/$ISO 4)))
pascal@17491 640 [ $(get $(($C+64)) /mnt/$ISO 4) -eq 1886961915 ] &&
pascal@17491 641 echo -en "\"$1\" \"$2\""
pascal@17491 642 }
pascal@17491 643
pascal@18034 644 burnable()
pascal@18034 645 {
pascal@21801 646 [ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info 2>/dev/null)" ] &&
pascal@18034 647 [ "$(which wodim)" ] && echo -en "\"$1\" \"$2\""
pascal@18034 648 }
pascal@18034 649
pascal@18034 650 blankable()
pascal@18034 651 {
pascal@21801 652 [ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info 2>/dev/null)" ] &&
pascal@18034 653 [ "$(which wodim)" ] && echo -en "\"$1\" \"$2\""
pascal@18034 654 }
pascal@18034 655
pascal@18034 656 burniso()
pascal@18034 657 {
pascal@18034 658 wodim -v speed=$(fgrep "drive speed" /proc/sys/dev/cdrom/info | cut -f3) \
pascal@18034 659 -eject -multi "$ISO"
pascal@18034 660 }
pascal@18034 661
pascal@18034 662 blankcd()
pascal@18034 663 {
pascal@18034 664 wodim -v -blank=fast
pascal@18034 665 }
pascal@18034 666
pascal@18771 667 customsector()
pascal@18771 668 {
pascal@19324 669 echo $(get 32848 "/mnt/$ISO" 4)
pascal@18771 670 }
pascal@18771 671
pascal@18771 672 hascustomconf()
pascal@18771 673 {
pascal@18771 674 [ "$(ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | ddq bs=1 count=6)" \
pascal@20891 675 = "#!boot" ]
pascal@18771 676 }
pascal@18771 677
pascal@18771 678 gotcustomconf()
pascal@18771 679 {
pascal@18774 680 hascustomconf && echo -en "\"$1\" \"$2\""
pascal@18771 681 }
pascal@18771 682
pascal@18771 683 getcustomconf()
pascal@18771 684 {
pascal@18774 685 cd ${1:-/mnt}
pascal@18774 686 ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | while read line; do
pascal@18771 687 case "$line" in
pascal@21801 688 \#!boot*);;
pascal@21801 689 append=*) echo ${line#append=} > cmdline && ls -l cmdline;;
pascal@18771 690 initrd:*) cnt=${line#initrd:}
pascal@18771 691 { ddq bs=512 count=$(($cnt / 512));
pascal@18771 692 ddq bs=1 count=$(($cnt % 512)); } > initrd &&
pascal@18771 693 ls -l initrd
pascal@21801 694 break;;
pascal@21801 695 *) break;;
pascal@18771 696 esac
pascal@18771 697 done
pascal@18771 698 cd - > /dev/null
pascal@18774 699 [ -z "$1" ] && echo -e "\rPress RETURN to continue." && read n
pascal@18771 700 }
pascal@18771 701
pascal@17492 702 gotisomd5()
pascal@17492 703 {
pascal@21801 704 [ "$(which md5sum 2>/dev/null)" ] &&
pascal@17635 705 [ $(get 0 /mnt/$ISO) -eq 23117 ] &&
pascal@17635 706 [ $(get 18 /mnt/$ISO) -ne 0 ] && echo -en "\"$1\" \"$2\""
pascal@17492 707 }
pascal@17492 708
pascal@17492 709 isomd5()
pascal@17492 710 {
pascal@17492 711 dotwait "Checking iso image"
pascal@17635 712 [ "$(ddq if=/mnt/$ISO bs=2k skip=16 \
pascal@20891 713 count=$(($(get 32848 /mnt/$ISO 4)-16)) | md5sum)" = \
pascal@17635 714 "$(ddq if=/mnt/$ISO bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \
pascal@17496 715 sed 's/ //g') -" ] && echo "OK" || echo "ERROR"
pascal@17635 716 echo -en "\rChecking iso hybrid boot..."
pascal@17635 717 n=$(($(get 2 /mnt/$ISO)-1+($(get 4 /mnt/$ISO)-1)*512))
pascal@17635 718 if [ $n -lt 40000 -a $n -gt 32768 ]; then
pascal@17635 719 s=$(get 0 /mnt/$ISO 2 $n | awk '{ i+= $0 } END { print i }')
pascal@17635 720 [ $(((1+$s+$(get $(($n+1)) /mnt/$ISO 1)) % 65536)) -eq 0 ] &&
pascal@17635 721 echo "OK" || echo "ERROR"
pascal@17635 722 fi
pascal@18771 723 if hascustomconf; then
pascal@18771 724 echo -en "\rChecking iso custom config..."
pascal@18771 725 TMP=/tmp/$(basename $0)$$md5
pascal@18771 726 md5="$(ddq bs=2k skip=$(customsector) if=/mnt/$ISO | while read line; do
pascal@18771 727 case "$line" in
pascal@21801 728 \#!boot*) echo ${line#*boot } > $TMP;;
pascal@21801 729 append=*) echo $line;;
pascal@18771 730 initrd:*) echo $line
pascal@18771 731 cnt=${line#initrd:}
pascal@18771 732 ddq bs=512 count=$((cnt / 512))
pascal@18771 733 ddq bs=1 count=$((cnt % 512))
pascal@21801 734 break;;
pascal@21801 735 *) break;;
pascal@18771 736 esac
pascal@18771 737 done | md5sum | cut -c1-32)"
pascal@20891 738 [ "$md5" = "$(cat $TMP)" ] && echo "OK" || echo "ERROR"
pascal@18771 739 rm -f $TMP
pascal@18771 740 fi
pascal@17492 741 rm -f /tmp/wait
pascal@17562 742 echo -e "\rPress RETURN to continue."
pascal@17496 743 read n
pascal@17492 744 }
pascal@17492 745
pascal@20891 746 if [ "$1" = "--build" ]; then #install-begin
pascal@20763 747 cp $0 $0.tmp
pascal@20763 748 uuencode -m - < ifmem.bin | sed -e 's|^[ \t]*||;s|[ \t]*###.*||' \
pascal@20771 749 -e 's| *;;|;;|;s|\t\t*|\t|g' \
pascal@20763 750 -e '/^ifmemcode$/r/dev/stdin' -e '/^ifmemcode$/d' -i $0.tmp
pascal@18771 751 uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \
pascal@20764 752 -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0.tmp
pascal@20763 753 mv -f $0.tmp $0; exit
pascal@18771 754 fi #install-end
pascal@18771 755 parse_isolinux()
pascal@18771 756 {
pascal@18771 757 awk 'BEGIN { IGNORECASE=1 }
pascal@18771 758 function multi(n)
pascal@18771 759 {
pascal@18771 760 auto=$n
pascal@18771 761 for (--n; n < NF; n+=2) {
pascal@18771 762 s=$n
pascal@18771 763 if (s ~ /M$/) s = substr(s,0,length(s)-1)
pascal@18771 764 else s /= 1024
pascal@18771 765 sizes=int(s) " " sizes
pascal@18771 766 }
pascal@18771 767 next
pascal@18771 768 }
pascal@18771 769 {
pascal@18771 770 if ($1 == "LABEL") {
pascal@18771 771 label=$2
pascal@18771 772 if (auto == "") auto=label
pascal@18771 773 }
pascal@18771 774 if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2
pascal@18771 775 if ($1 == "INITRD") initrd[label]=$2
pascal@18771 776 if ($1 == "APPEND") {
pascal@18771 777 i=2
pascal@18771 778 if (kernel[label] ~ "ifmem.c32") multi(3)
pascal@18771 779 if (kernel[label] ~ "c32box.c32") {
pascal@18771 780 if ($2 == "linux") { kernel[label]=$3; i=4 }
pascal@18771 781 if ($2 == "ifmem") multi(4)
pascal@18771 782 }
pascal@18771 783 if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next }
pascal@18771 784 while (i <= NF) {
pascal@18771 785 if ($i ~ "^initrd=") initrd[label]=substr($i,8)
pascal@18771 786 else cmdline[label]=cmdline[label] " " $i
pascal@18771 787 i++
pascal@18771 788 }
pascal@18771 789 }
pascal@18771 790 }
pascal@18771 791 END {
pascal@18771 792 print "KERNEL=\"" kernel[auto] "\""
pascal@18771 793 print "INITRD=\"" initrd[auto] "\""
pascal@18771 794 print "CMDLINE=\"" substr(cmdline[auto],2) "\""
pascal@18771 795 print "SIZES=\"" sizes "\""
pascal@18771 796 }'
pascal@18771 797 }
pascal@18771 798
pascal@18771 799 locase()
pascal@18771 800 {
pascal@18771 801 echo "$1" | tr [A-Z] [a-z]
pascal@18771 802 }
pascal@18771 803
pascal@18771 804 ifmemcode()
pascal@18771 805 {
pascal@18771 806 uudecode <<EOT
pascal@18771 807 ifmemcode
pascal@18771 808 EOT
pascal@18771 809 }
pascal@18771 810
pascal@18771 811 floppyset()
pascal@18771 812 {
pascal@18771 813 gotcdfile isolinux.cfg
pascal@18771 814 parse_isolinux < $file > /tmp/var$$
pascal@18771 815 . /tmp/var$$
pascal@19877 816 for i in /media/cdrom/$KERNEL $(dirname $file)/$KERNEL /media/cdrom/$(locase $KERNEL) \
pascal@18771 817 $(dirname $file)/$(locase $KERNEL); do
pascal@18771 818 [ -s $i ] && KERNEL=$i && break
pascal@18771 819 done
pascal@20771 820 rm -f /tmp/var$$
pascal@18771 821 [ $(get 514 $KERNEL 4) -eq 1400005704 ] || return
pascal@18771 822 n=$(($(get 497 $KERNEL 1)+1))
pascal@18771 823 ddq bs=512 count=$n if=$KERNEL of=/tmp/fd$$
pascal@18771 824 uudecode <<EOT | ddq of=/tmp/fd$$ conv=notrunc
pascal@18771 825 bootloader
pascal@18771 826 EOT
pascal@18771 827 pos=$(($n*512))
pascal@18771 828 if [ -n "$CMDLINE" ]; then
pascal@18771 829 echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$
pascal@18771 830 bytes2bin $n | ddq conv=notrunc \
pascal@18771 831 bs=1 seek=497 count=1 of=/tmp/fd$$
pascal@18771 832 words2bin $pos | ddq conv=notrunc \
pascal@18771 833 bs=1 seek=34 count=2 of=/tmp/fd$$
pascal@18771 834 [ $(get 518 $KERNEL 4) -ge 514 ] &&
pascal@18771 835 words2bin 32768 9 | ddq conv=notrunc \
pascal@18771 836 bs=1 seek=552 count=4 of=/tmp/fd$$
pascal@18771 837 fi
pascal@18771 838 syssize=$(echo $(get 500 /tmp/fd$$ 4))
pascal@18771 839 ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \
pascal@18771 840 ddq bs=512 count=$((($syssize+31)/32)) conv=sync >> /tmp/fd$$
pascal@18771 841 base=$(stat -c %s /tmp/fd$$)
pascal@18771 842 len=
pascal@18771 843 if [ "$INITRD" ]; then
pascal@18771 844 l=0
pascal@18771 845 for i in ${INITRD//,/ }; do
pascal@19877 846 for j in /media/cdrom/$i $(dirname $KERNEL)/$i /media/cdrom/$(locase $i) \
pascal@18771 847 $(dirname $KERNEL)/$(locase $i); do
pascal@18771 848 [ -s $j ] && i=$j && break
pascal@18771 849 done
pascal@18771 850 ddq if=$i >> /tmp/fd$$
pascal@18771 851 l=$(($l+$(stat -c %s $i)))
pascal@18771 852 r=$((4 - ($l % 4)))
pascal@18771 853 if [ $r -ne 4 ]; then
pascal@18771 854 ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$
pascal@18771 855 l=$(($l + $r))
pascal@18771 856 fi
pascal@18771 857 case "$i:$INITRD" in
pascal@20762 858 *rootfs.gz:*rootfs.gz,*) continue ### loram
pascal@18771 859 esac
pascal@18771 860 len="$len $l"; l=0
pascal@18771 861 done
pascal@18771 862 rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))}
pascal@18771 863 words2bin $(($rdadrs & 0xFFFF)) $(($rdadrs >> 16)) | ddq \
pascal@18771 864 conv=notrunc bs=1 seek=536 count=4 of=/tmp/fd$$
pascal@18771 865 fi
pascal@18771 866 n=$(echo $len | wc -w)
pascal@18771 867 if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then
pascal@18771 868 i=$(($(get 494 /tmp/fd$$)))
pascal@18771 869 bytes2bin $(($i + ($n*4) - 256)) | ddq bs=1 conv=notrunc \
pascal@18771 870 seek=496 count=1 of=/tmp/fd$$
pascal@18771 871 else
pascal@18771 872 i=$(($pos + 0x1FC - ($n*4)))
pascal@18771 873 bytes2bin $(($i % 256)) $((i / 256)) 252 | ddq bs=1 \
pascal@18771 874 conv=notrunc seek=494 count=3 of=/tmp/fd$$
pascal@18771 875 s=$(($i - 2*$(echo "$SIZES" | wc -w)))
pascal@18771 876 p=$(($s - $(ifmemcode | wc -c)))
pascal@18771 877 ifmemcode | ddq bs=1 conv=notrunc seek=$p of=/tmp/fd$$
pascal@18771 878 words2bin $SIZES | ddq bs=1 conv=notrunc seek=$s of=/tmp/fd$$
pascal@18771 879 bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \
pascal@18771 880 ddq bs=1 conv=notrunc seek=60 of=/tmp/fd$$
pascal@18771 881 fi
pascal@21801 882 for r in $len; do
pascal@18771 883 words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddq conv=notrunc \
pascal@18771 884 bs=1 seek=$i count=4 of=/tmp/fd$$
pascal@18771 885 i=$(($i + 4))
pascal@18771 886 done
pascal@18771 887 split -b 1440k /tmp/fd$$ fd$$
pascal@18771 888 rm -f /tmp/fd$$
pascal@18771 889 n=1; i=0; r=0
pascal@18771 890 set -- $len
pascal@21801 891 ls fd$$* | while read file; do
pascal@18771 892 if [ $i -gt $(($1+$base)) ]; then
pascal@18771 893 shift
pascal@18771 894 r=$(($r+100)); n=0; i=0; base=0
pascal@18771 895 fi
pascal@18771 896 ddq of=$file bs=18k seek=80 count=0
pascal@18771 897 i=$(($i+1474560))
pascal@18771 898 printf "mv %s fd%03d.img\n" $file $(($r+$n))
pascal@18771 899 n=$(($n+1))
pascal@18771 900 done | sh
pascal@18771 901 ls fd???.img
pascal@19878 902 mv fd???.img /mnt
pascal@18771 903 }
pascal@18771 904
pascal@14257 905 fdbootstrap()
pascal@14257 906 {
pascal@18771 907 sz=$((512 * $(echo $(get 26 /mnt/$ISO 1))))
pascal@20771 908 $DIALOG --clear --title " Create a floppy bootstrap " \
pascal@14271 909 --yes-label "Continue" --yesno \
paul@14263 910 "\nThe floppy will install a driver to access the ISO file
pascal@20771 911 on your hard disk and will emulate a CD-ROM during the boot process.\n\n
pascal@20771 912 Please insert a floppy in drive now.\n" 10 70
pascal@14271 913 [ $? -eq 0 ] || return
pascal@17474 914 ddq if=/mnt/$ISO of=/tmp/bootiso bs=1 count=512 \
pascal@17810 915 skip=$(( $(get 64 /mnt/$ISO) - $sz ))
pascal@17474 916 echo "$ISO" | ddq of=/tmp/bootiso bs=512 seek=1 count=1
pascal@17474 917 ddq if=/mnt/$ISO of=/tmp/bootiso bs=1 count=$sz seek=2 \
pascal@17810 918 skip=$(( $(get 64 /mnt/$ISO) - $sz + 512 ))
pascal@17474 919 mkfloppy /tmp/bootiso
pascal@17474 920 rm -f /tmp/bootiso
pascal@14257 921 }
pascal@14257 922
pascal@14257 923 usbdev()
pascal@14257 924 {
pascal@17476 925 dotwait "Wait 5 seconds for USB devices"
pascal@14257 926 sleep 5
pascal@17476 927 rm -f /tmp/wait
pascal@14257 928 DEV="$(grep -l 1 /sys/block/*/removable | \
pascal@14257 929 sed 's|/sys/block/\(.*\)/removable|\1|')"
pascal@17491 930 grep -qs 1 /sys/block/$DEV/ro && return
pascal@17454 931 [ "$DEV" ] || return
pascal@17491 932 cat > /tmp/dialog <<EOT
pascal@20778 933 $DIALOG --clear --title " Select your USB key " \
pascal@14257 934 --menu "\nPlease select the USB key according to its known size.\n\n" \
pascal@14257 935 14 70 4 \
pascal@21801 936 $(for i in $DEV; do
pascal@21801 937 echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2>/dev/null)\" "
pascal@20762 938 done)
pascal@17491 939 EOT
pascal@17491 940 exec 3>&1
pascal@17491 941 device=$(. /tmp/dialog 2>&1 1>&3)
pascal@14257 942 retval=$?
pascal@14257 943 exec 3>&-
pascal@14257 944 [ $retval -eq 0 ]
pascal@14257 945 }
pascal@14257 946
pascal@17491 947 tazusbmsg()
pascal@17491 948 {
pascal@21801 949 [ "$(which tazusb 2>/dev/null)" ] || return
pascal@17491 950 echo "You should choose 'USB key read/write installation' to be
pascal@17491 951 able to save the package updates or your own configuration and data files.\n\n"
pascal@17491 952 }
pascal@17491 953
pascal@14257 954 usbbootkey()
pascal@14257 955 {
pascal@20771 956 $DIALOG --clear --title " Create a USB boot key " \
pascal@14257 957 --yes-label "Continue" --yesno \
pascal@14257 958 "\nThe USB key will be used like a CD-ROM. You will not be able to write
pascal@17454 959 any data on the boot partition.\n\n
pascal@17454 960 An extra FAT32 partition will be created with the remaining free space.\n\n
pascal@20771 961 $(tazusbmsg)Please plug your USB stick in now.\n" 16 70
pascal@14257 962 [ $? -eq 0 ] || return
pascal@14257 963 usbdev || return
pascal@17454 964
pascal@20762 965 ### perform dd in progress bar
pascal@17491 966 max=$(($(cat /sys/block/loop0/size)/2048))
pascal@20771 967 i=0; ddq if=/mnt/$ISO bs=1024k | (
pascal@21801 968 while ddq bs=1024k count=1; do
pascal@17454 969 i=$(($i + 1))
pascal@17454 970 [ $i -gt $max ] && break
pascal@17455 971 echo $((($i*100)/$max)) | dialog --gauge \
pascal@17455 972 " The ISO image transfer can be long. Please wait..." \
pascal@17476 973 6 70 0 > /dev/tty0 2>&1
pascal@17454 974 done ) > $device
pascal@17454 975
pascal@20762 976 ### partition + fat32 format for the remaining space
pascal@17860 977 for p in 0 16; do
pascal@17860 978 get $((450+$p)) $device 2 12 | xargs echo | {
pascal@17860 979 read dx cx ol oh ll lh
pascal@17860 980 [ $dx -eq $((0x3F17)) ] || continue
pascal@17454 981 cx=$(($cx & 0xFF00))
pascal@17454 982 ofs=$(($ll+($lh<<16)))
pascal@17454 983 n=$(($(cat /sys/block/${device#/dev/}/size)-$ofs))
pascal@17454 984 m=$(($cx+($n/8)))
pascal@17454 985 [ $m -gt $((0x3FF00)) ] && m=$((0x3FF00))
pascal@17454 986 m=$((($m & 0xFF00)+(($m>>16)<<6)))
pascal@17454 987 words2bin 0 $((0x101+$cx)) 0x3F0B $((32+$m)) \
pascal@17454 988 $ll $lh $(($n & 0xFFFF)) $(($n >> 16)) | \
pascal@17860 989 ddq bs=1 seek=$((462-$p)) of=$device
pascal@21801 990 if [ "$(which mkdosfs 2>/dev/null)" ]; then
pascal@17562 991 losetup -o $((512*$ofs)) /dev/loop2 $device
pascal@17562 992 mkdosfs -n "SLITAZ BOOT" /dev/loop2
pascal@17454 993 words2bin $(($ofs & 0xFFFF)) $(($ofs >> 16)) | \
pascal@17562 994 ddq bs=1 seek=28 of=/dev/loop2
pascal@17860 995 sync
pascal@17562 996 losetup -d /dev/loop2
pascal@17454 997 fi
pascal@17860 998 }
pascal@17860 999 done
pascal@14257 1000 }
pascal@14257 1001
pascal@13697 1002 usbkey()
pascal@13697 1003 {
pascal@20771 1004 $DIALOG --clear --title " Create a SliTaz USB key " \
pascal@13697 1005 --yes-label "Continue" --yesno \
pascal@13697 1006 "\nUnlike a hard drive install, the filesystem is kept in a compressed
pascal@13697 1007 rootfs.gz. The filesystem is loaded entirely into memory upon boot.
pascal@13697 1008 This should increase responsiveness, protect the filesystem against
pascal@13697 1009 accidental corruption and reduce read/writes to the USB drive.
pascal@13697 1010 Once setup, the tazusb utility can rewrite the root filesystem
pascal@20771 1011 with any changes you have made since booting up,
pascal@13697 1012 giving the effective benefits of a hard drive install.\n\n
pascal@13697 1013 /home is mounted on boot using the UUID of your particular flash drive.
pascal@13697 1014 Unlike a device name, the UUID has the benefit of never changing from machine
pascal@13697 1015 to machine.\n\n
pascal@20771 1016 Please plug your USB stick in now.\n" 19 70
pascal@14271 1017 [ $? -eq 0 ] || return
pascal@14257 1018 usbdev || return
pascal@13697 1019 exec 3>&1
pascal@20778 1020 format=`$DIALOG --clear --title " Select the filesystem " \
pascal@13733 1021 --radiolist "\nPlease select the filesystem type to create.\n\n\
paul@13698 1022 The filesystem creation will erase all the data \
pascal@13699 1023 in the USB key." 14 70 4 \
pascal@13733 1024 "none" "Do not erase the USB key" on \
pascal@13733 1025 "ext3" "Ext3 journaling filesystem" off \
pascal@13733 1026 "ext2" "Ext2 filesystem" off \
pascal@13733 1027 "fat32" "Windows FAT32 filesystem" off \
pascal@13697 1028 2>&1 1>&3`
pascal@13697 1029 retval=$?
pascal@13697 1030 exec 3>&-
pascal@14257 1031 [ $retval -eq 0 ] || return
pascal@13697 1032 [ "$format" != "none" ] && tazusb format $device "SliTaz" $format
pascal@13697 1033 tazusb gen-iso2usb /mnt/$ISO $device
pascal@13697 1034 }
pascal@13697 1035
pascal@13713 1036 mount_loram()
pascal@13713 1037 {
pascal@13713 1038 is_loram || return
pascal@21801 1039 insmod /lib/modules/squashfs.ko* 2>/dev/null
pascal@13713 1040 if [ -d /media/cdrom/fs ]; then
pascal@13713 1041 ln -s /media/cdrom/fs /sqfs
pascal@13713 1042 else
pascal@13713 1043 mkdir /sqfs
pascal@21801 1044 losetup -o 124 /dev/loop6 $(ls_r /media/cdrom/boot/rootfs?*.* | sed q)
pascal@21801 1045 mount -r /dev/loop6 /sqfs
pascal@13713 1046 fi
pascal@21506 1047 cp -a /sqfs/dev/fuse /sqfs/dev/tty[12] /sqfs/dev/[hs]d* /dev
pascal@21801 1048 ln -s /sqfs/lib/* lib 2>/dev/null
pascal@21386 1049 ln -fs /sqfs/usr /sqfs/var /
pascal@21801 1050 mkdir /etc && cp /sqfs/etc/dialogrc /etc 2>/dev/null
pascal@13713 1051 }
pascal@13713 1052
pascal@13713 1053 umount_loram()
pascal@13713 1054 {
pascal@13713 1055 is_loram || return
pascal@20778 1056 rm /var /usr
pascal@13713 1057 umount -d /sqfs
pascal@21801 1058 rmdir /sqfs 2>/dev/null || rm -f /sqfs
pascal@21801 1059 rm -rf /etc
pascal@13713 1060 }
pascal@13713 1061
pascal@17569 1062 dosync()
pascal@13691 1063 {
pascal@17569 1064 sync
pascal@13713 1065 umount_loram
pascal@13691 1066 umount -d /media/cdrom
pascal@16073 1067 rm -f /dev/cdrom
pascal@13691 1068 umount /mnt
pascal@16041 1069 umount_proc
pascal@17569 1070 }
pascal@17569 1071
pascal@17569 1072 text()
pascal@17569 1073 {
pascal@21801 1074 uncpio $(ls_r /media/cdrom/boot/rootfs?*.* | sed q)
pascal@18774 1075 init=
pascal@18774 1076 cmdline="$(cat /proc/cmdline)"
pascal@18774 1077 if hascustomconf; then
pascal@18774 1078 getcustomconf /tmp > /dev/null
pascal@18774 1079 [ -s /tmp/cmdline ] &&
pascal@18774 1080 cmdline="$cmdline $(cat /tmp/cmdline)" &&
pascal@18774 1081 init="$(sed '/rdinit=/!d;s/.*rdinit=\([^ ]*\).*/\1/' < /tmp/cmdline)"
pascal@18774 1082 [ -s /tmp/initrd ] && uncpio /tmp/initrd
pascal@18774 1083 fi
pascal@17569 1084 dosync
pascal@21791 1085 sed -i 's/ || exit//' /init
pascal@18774 1086 exec ${init:-/init} $cmdline
pascal@13691 1087 }
pascal@13691 1088
pascal@13691 1089 live()
pascal@13691 1090 {
pascal@13691 1091 n=0
pascal@17476 1092 dotwait "Extract filesystem..."
pascal@21801 1093 for i in $(ls_r /media/cdrom/boot/rootfs*); do
pascal@13691 1094 [ $((n++)) -eq 0 ] || uncpio $i
pascal@13691 1095 done
pascal@17476 1096 rm -f /tmp/wait
pascal@13691 1097 text
pascal@13691 1098 }
pascal@13691 1099
pascal@13713 1100 restart()
pascal@13691 1101 {
pascal@17476 1102 dosync
pascal@13713 1103 reboot -f
pascal@13691 1104 }
pascal@13691 1105
pascal@13713 1106 stop()
pascal@13691 1107 {
pascal@17476 1108 dosync
pascal@13713 1109 poweroff -f
pascal@13691 1110 }
pascal@13691 1111
pascal@17489 1112 dokexec()
pascal@17476 1113 {
pascal@17659 1114 kexec -l $file || return
pascal@17476 1115 dosync
pascal@17476 1116 kexec -e
pascal@17476 1117 }
pascal@17476 1118
pascal@17489 1119 runmemtest()
pascal@17489 1120 {
pascal@17635 1121 gotcdfile "memtest*" && dokexec
pascal@17489 1122 }
pascal@17489 1123
pascal@17476 1124 runpxe()
pascal@17476 1125 {
pascal@20762 1126 gotcdfile "?pxe*" && dokexec
pascal@17476 1127 }
pascal@17476 1128
pascal@17931 1129 flavdata()
pascal@17931 1130 {
pascal@20762 1131 [ $(get 1024 /mnt/$ISO) -eq 35615 ] && n=2 ||
pascal@20762 1132 n=$((1+$(get 417 /mnt/$ISO 1)))
pascal@20762 1133 [ $n -eq 4 ] && n=20
pascal@20762 1134 [ $(get $(($n*512)) /mnt/$ISO) -eq 35615 ] || n=13
pascal@20762 1135 ddq if=/mnt/$ISO bs=512 skip=$n count=20 | zcat 2>/dev/null
pascal@17931 1136 }
pascal@17931 1137
pascal@17931 1138 hasflavinfo()
pascal@17931 1139 {
pascal@20891 1140 [ "$(flavdata | ddq bs=1 count=7)" = "0707010" ] &&
pascal@19510 1141 echo -en "\"$1\" \"$2\""
pascal@17931 1142 }
pascal@17931 1143
pascal@17931 1144 showfavinfo()
pascal@17931 1145 {
pascal@17931 1146 mkdir -p /tmp/data
pascal@21801 1147 flavdata | ( cd /tmp/data; cpio -i )
pascal@17931 1148 file=/tmp/data/info
pascal@17931 1149 cat /tmp/data/*desc > $file
pascal@21801 1150 for i in /tmp/data/*list*; do
pascal@17931 1151 echo "=== extra ${i#*list} files"
pascal@17931 1152 cat $i
pascal@17931 1153 done >> $file
pascal@20771 1154 $DIALOG --clear --title " Flavor info " --textbox $file 24 78
pascal@17931 1155 rm -rf /tmp/data
pascal@17931 1156 }
pascal@17931 1157
pascal@18771 1158 flavor()
pascal@18771 1159 {
pascal@18771 1160 cd /mnt
pascal@21801 1161 name="$(flavdata | cpio -t 2>/dev/null | sed 's/.[a-z]*$//;q')"
pascal@18771 1162 echo "Create ${name:=flavor}.flavor..."
pascal@18771 1163 tazlito iso2flavor "/mnt/$ISO" $name
pascal@21801 1164 ls -l $name.flavor 2>/dev/null || sleep 5
pascal@18771 1165 cd - > /dev/null
pascal@18771 1166 }
pascal@18771 1167
pascal@13697 1168 shell()
pascal@13697 1169 {
pascal@20771 1170 trap text 2
pascal@21801 1171 getty -n -l /bin/ash 38400 tty1 2>/dev/null || sh
pascal@13697 1172 }
pascal@13697 1173
pascal@14247 1174 BIN=bin/mount.posixovl
pascal@14247 1175 [ -x /usr/s$BIN ] || mv /bin/mount.posixovl.iso2exe \
pascal@21801 1176 /usr/s$BIN 2>/dev/null || mv /bin/mount.posixovl.iso2exe /$BIN 2>/dev/null
pascal@16041 1177 mount_proc
pascal@21801 1178 for i in /sys/block/*/dev /sys/block/*/*/dev; do
pascal@18804 1179 [ -s "$i" ] || continue
pascal@18804 1180 n=${i%/dev}
pascal@18804 1181 n=/dev/${n##*/}
pascal@18804 1182 [ -e $n ] && continue
pascal@18804 1183 mknod $n b $(sed 's/:/ /' < $i)
pascal@21801 1184 done 2>/dev/null
pascal@17489 1185 ISO="$(getarg bootfrom | sed 's/.://;s|\\|/|g')"
pascal@21801 1186 getiso 2>/dev/null || text
pascal@13713 1187 mount_loram
pascal@16041 1188 case "${ISO##*/}$(getarg mode)" in
pascal@21801 1189 *install*|*INSTALL*) install;;
pascal@21801 1190 *live*|*LIVE*) live;;
pascal@21801 1191 *text*|*TEXT*) text;;
pascal@13691 1192 esac
pascal@21801 1193 which $DIALOG 2>/dev/null || DIALOG=tinydialog
pascal@13713 1194 dmesg > /tmp/dmesg
pascal@13691 1195
pascal@18778 1196 isotitle="$(blkid /mnt/$ISO | sed 's/.*LABEL="\([^"]*\).*/\1/') $(stat \
pascal@18778 1197 -c %y /media/cdrom | sed 's/ .*//') $(basename $ISO)"
pascal@13691 1198 while true; do
pascal@20771 1199 trap shell 2
pascal@21801 1200 keymap="$(cat /etc/keymap.conf 2>/dev/null)"
pascal@21801 1201 locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)"
pascal@14271 1202 cat > /tmp/dialog <<EOT
pascal@20778 1203 $DIALOG --clear --title " ${isotitle:-Welcome to Linux} " \
pascal@17454 1204 --menu "" 23 70 17 \
pascal@17489 1205 $(xfile tazkeymap "tazkeymap" "Select keyboard (${keymap:-none})") \
pascal@17489 1206 $(xfile tazlocale "tazlocale" "Select locale (${locale:-none})") \
pascal@17489 1207 $(cdfile boot/bzImage "live" "Linux RAM boot (full desktop)") \
pascal@17489 1208 "text" "Linux RAM boot" \
pascal@17635 1209 $(cdfile "README*" "readme" "Show the README file") \
pascal@18771 1210 $(gotcustomconf "getcustomconf" "Get custom config") \
pascal@17492 1211 $(gotisomd5 "isomd5" "Check the ISO image") \
pascal@17635 1212 $(cdfile "md5sum*" "md5" "Check the ISO files") \
pascal@17635 1213 $(cdfile "sha*sum*" "sha" "Check the ISO files") \
pascal@18034 1214 $(burnable "burniso" "Burn the ISO image") \
pascal@18034 1215 $(blankable "blankcd" "Blank the CD/DVD") \
pascal@16041 1216 $(gotposixovl "install" "Hard disk installation (UMSDOS way)") \
pascal@16041 1217 $(gotposixovl "installtaz" "Hard disk installation (TAZUSB way)") \
pascal@14271 1218 $(xfile tazusb "usbkey" "USB key read/write installation") \
pascal@17491 1219 $(ishybrid "usbbootkey" "USB boot key (read only)") \
paul@17935 1220 $(hasflavinfo "showfavinfo" "Show flavor extra info") \
pascal@18771 1221 $(xfile tazlito "flavor" "Get flavor file") \
pascal@17476 1222 $(fddata "fdbootstrap" "Create a floppy bootstrap") \
pascal@18771 1223 $(cdfile isolinux.cfg "floppyset" "Boot floppy set") \
pascal@17491 1224 "tazboot" "Get tazboot.exe Linux loader" \
pascal@17476 1225 $(cdexe boot/bzImage "bzimage" "Get linux DOS/EXE file") \
pascal@17635 1226 $(cdexe "memtest*" "memtest" "Get Memtest86 DOS/EXE file") \
pascal@17635 1227 $(cdfilef "memtest*" "fdmemtest" "Create a Memtest86 boot floppy") \
pascal@18771 1228 $(:||cdfilex "memtest*" "runmemtest" "Start Memtest86") \
pascal@20762 1229 $(cdexe "?pxe*" "pxe" "Get SliTaz Web boot DOS/EXE utility") \
pascal@20762 1230 $(cdfilef "?pxe*" "fdpxe" "Create a SliTaz Web boot floppy") \
pascal@20762 1231 $(:||cdfilex "?pxe*" "runpxe" "Start the SliTaz Web boot utility") \
pascal@14271 1232 $(xfile reboot "restart" "Restart the computer") \
pascal@14271 1233 $(xfile poweroff "stop" "Power off") \
pascal@13697 1234 "bootlog" "Linux boot messages" \
pascal@20762 1235 "shell" "Shell prompt"
pascal@14271 1236 EOT
pascal@14271 1237 exec 3>&1
pascal@17489 1238 value=$(. /tmp/dialog 2>&1 1>&3)
pascal@13691 1239 retval=$?
pascal@13691 1240 exec 3>&-
pascal@13691 1241 [ $retval -eq 0 ] || continue
pascal@13691 1242 $value
pascal@13691 1243 done