wok rev 23820

syslinux: merge init.exe & taziso
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 28 08:35:55 2020 +0000 (4 months ago)
parents 55fda8af462e
children 0f864bb40808 7f4f0b699c28
files rsync/receipt syslinux/stuff/iso2exe/init syslinux/stuff/iso2exe/taziso syslinux/stuff/iso2exe/win32.c
line diff
     1.1 --- a/rsync/receipt	Wed May 27 17:52:58 2020 +0100
     1.2 +++ b/rsync/receipt	Thu May 28 08:35:55 2020 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4  MAINTAINER="pankso@slitaz.org"
     1.5  LICENSE="GPL3"
     1.6  TARBALL="$PACKAGE-$VERSION.tar.gz"
     1.7 -WEB_SITE="http://rsync.samba.org/"
     1.8 +WEB_SITE="https://rsync.samba.org/"
     1.9  WGET_URL="${WEB_SITE}ftp/rsync/$TARBALL"
    1.10  CONFIG_FILES="/etc/rsyncd.conf /etc/rsyncd.secrets"
    1.11  TAGS="sync copy secure"
     2.1 --- a/syslinux/stuff/iso2exe/init	Wed May 27 17:52:58 2020 +0100
     2.2 +++ b/syslinux/stuff/iso2exe/init	Thu May 28 08:35:55 2020 +0000
     2.3 @@ -1,97 +1,14 @@
     2.4  #!/bin/sh
     2.5  
     2.6 -DIALOG=dialog
     2.7 -
     2.8 -ddq()
     2.9 -{
    2.10 -	dd $@ 2>/dev/null
    2.11 -}
    2.12 -
    2.13 -get()
    2.14 -{
    2.15 -	od -v -j $1 -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} -An $2 2>/dev/null ||
    2.16 -	hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" $2
    2.17 -}
    2.18 -
    2.19  getarg()
    2.20  {
    2.21  	sed "/$1=/!d;s/.*$1=\\([^ ]*\\).*/\\1/" /proc/cmdline
    2.22  }
    2.23  
    2.24 -clear()
    2.25 +myget()
    2.26  {
    2.27 -	echo -e "\x1B[1;1H\x1B[J"
    2.28 -}
    2.29 -
    2.30 -xless()
    2.31 -{
    2.32 -	[ $(wc -l < "$1") -gt 22 ] &&
    2.33 -	sed 's/..3.;4.m/===/g;$s/.*/&\n---\nPress q to continue/' "$1" | less ||
    2.34 -	{	cat "$1"
    2.35 -		[ "$2" ] || return
    2.36 -		echo -e "$2"
    2.37 -		read n
    2.38 -	}
    2.39 -}
    2.40 -
    2.41 -tinydialog()
    2.42 -{
    2.43 -	clear
    2.44 -	label=""
    2.45 -	while [ "$1" ]; do
    2.46 -		case "$1" in
    2.47 -		--title) title="   \x1B[30;47m$2\x1B[37;40m\n"
    2.48 -			 echo -e $title; shift;;
    2.49 -		--yes-label) label="$2"; shift;;
    2.50 -		--textbox)
    2.51 -			xless "$2" "\nPress RETURN to continue."
    2.52 -			break;;
    2.53 -		--gauge)
    2.54 -			t="        "
    2.55 -			echo -e "$t$2\n"
    2.56 -			while read pct; do
    2.57 -				s="                              "
    2.58 -				s="$s$pct%$s"
    2.59 -				pct=$((($pct*63)/100))
    2.60 -				echo -en "\r$t\x1B[30;47m$(echo "$s" | cut -c-$pct)\x1B[37;40m$(echo "$s" | cut -c$(($pct+1))-)"
    2.61 -			done
    2.62 -			break;;
    2.63 -		--yesno)
    2.64 -			while true; do
    2.65 -				clear
    2.66 -				echo "$2" | sed 's/\\n\\n/\\n/g;s/\\n/\n/g'
    2.67 -				echo -en "  <-  1:${label:-Yes}  2:Cancel\r"
    2.68 -				read x
    2.69 -				case "$x" in
    2.70 -				''|Y*|y*|1) return 0;;
    2.71 -				N*|n*|2|0) return 1;;
    2.72 -				esac
    2.73 -			done;;
    2.74 -		--menu|--radiolist)
    2.75 -			[ "$1" = "--menu" ] && shft=2 || shft=3
    2.76 -			label=""
    2.77 -			[ "$2" ] && label="\n$2"
    2.78 -			shift 5
    2.79 -			echo -e "$title$label\n0	Cancel" > /tmp/data
    2.80 -			n=1
    2.81 -			while [ "$1" ]; do
    2.82 -				eval key_$n='$1'
    2.83 -				echo "$((n++))	$2"
    2.84 -				shift $shft
    2.85 -			done >> /tmp/data
    2.86 -			while ! grep -q "^$n	" /tmp/data; do
    2.87 -				clear
    2.88 -				xless /tmp/data
    2.89 -				echo -en "\n   <- Enter the selection number\r"
    2.90 -				read n
    2.91 -			done 2>/dev/null
    2.92 -			rm -f /tmp/data
    2.93 -			[ $n -eq 0 ] && return 1
    2.94 -			eval echo -n \$key_$n 1>&2
    2.95 -			return 0;;
    2.96 -		esac
    2.97 -		shift
    2.98 -	done
    2.99 +	od -v -j $1 -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} -An $2 2>/dev/null ||
   2.100 +	hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" $2
   2.101  }
   2.102  
   2.103  mount_proc()
   2.104 @@ -109,56 +26,31 @@
   2.105  	umount /proc
   2.106  }
   2.107  
   2.108 -bytes2bin()
   2.109 +checkmagic()
   2.110  {
   2.111 -	for i in $@; do
   2.112 -		printf '\\\\x%02X' $(($i&255))
   2.113 -	done | xargs echo -en
   2.114 +	[ -s $1 ] && [ $(getarg magic) = $(myget 18 $1 2) ]
   2.115  }
   2.116  
   2.117 -words2bin()
   2.118 -{
   2.119 -	for i in $@; do
   2.120 -		printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255))
   2.121 -	done | xargs echo -en
   2.122 -}
   2.123 -
   2.124 -gettazboot()
   2.125 -{
   2.126 -	echo -e "\nCreating $(basename $1) ..."
   2.127 -	S=$((32+HEADERSZ))
   2.128 -	P=$((($S+511)/512))
   2.129 -	E=$((4096-(32*$P)))
   2.130 -	words2bin 0x5A4D $(($S%512)) $P 0 2 $E -1 -16 \
   2.131 -			-2 0 256 -16 28 0x6C53 0x5469 0x7A61 > $1
   2.132 -	uudecode - >> $1 << EOT
   2.133 -HEADERCODE
   2.134 -EOT
   2.135 -	gotcdfile linld.com
   2.136 -	ddq if=$file >> $1
   2.137 -}
   2.138 -
   2.139 -checkmagic()
   2.140 -{
   2.141 -	[ -s $1 ] && [ $(getarg magic) = $(get 18 $1 2) ]
   2.142 -}
   2.143 -
   2.144 +media=/media/cdrom
   2.145 +mnt=/mnt
   2.146  getiso()
   2.147  {
   2.148 -	mkdir -p /media/cdrom
   2.149 +	mkdir -p $media
   2.150  	for dev in /sys/block/?d?/?d??*; do
   2.151 -		mount /dev/$(basename $dev) /mnt
   2.152 -		if checkmagic /mnt/$ISO; then
   2.153 -			mount -o loop,ro /mnt/$ISO /media/cdrom
   2.154 +		mount /dev/$(basename $dev) $mnt
   2.155 +		if checkmagic $mnt/$ISO; then
   2.156 +			mount -o loop,ro $mnt/$ISO $media
   2.157  			echo "Found $ISO on $(basename $dev)"
   2.158 +			ISO=$mnt/$ISO
   2.159  			return 0
   2.160  		fi
   2.161 -		umount /mnt
   2.162 +		umount $mnt
   2.163  	done 2>/dev/null
   2.164  	return 1
   2.165  }
   2.166  
   2.167 -uncpio()
   2.168 +uncpio=uncpio64
   2.169 +uncpio64()
   2.170  {
   2.171  	i=$1
   2.172  	sed 's|$| |' /proc/cpuinfo | grep ' lm ' && [ -s ${i}64 ] && i=${i}64
   2.173 @@ -172,875 +64,34 @@
   2.174  	esac < $i | ( cd ${2:-/}; cpio -idmu > /dev/null 2>&1 )
   2.175  }
   2.176  
   2.177 -dotwait()
   2.178 -{
   2.179 -	echo -n "${1:-Install filesystem}.."
   2.180 -	echo -n > /tmp/wait
   2.181 -	while [ -e /tmp/wait ]; do
   2.182 -		echo -n "." > /dev/tty0
   2.183 -		sleep 1
   2.184 -	done &
   2.185 -}
   2.186 -
   2.187 -getuuid()
   2.188 -{
   2.189 -	dev=$(mount | sed '/ \/mnt /!d;s/ .*//;s|/dev/||;q')
   2.190 -	blkid | sed "/$dev:/!d;s/.* UUID=.\\([^ ]*\\)\".*/\\1/"
   2.191 -}
   2.192 -
   2.193 -tazusbinitfs()
   2.194 -{
   2.195 -	PAD=$(($(stat -c %s $1) % 4))
   2.196 -	[ $PAD -ne 0 ] && ddq if=/dev/zero bs=1 count=$((4 - $PAD)) >> $1
   2.197 -	mkdir -p /tmp/fs/etc /tmp/fs/lib /tmp/fs/home
   2.198 -	cp /etc/keymap.conf /etc/locale.conf /tmp/fs/etc 2>/dev/null
   2.199 -	cat > /tmp/fs/init1 <<EOT
   2.200 -#!/bin/sh
   2.201 -sed -i 's|sbin/init|init2|' /init
   2.202 -exec /init
   2.203 -EOT
   2.204 -	cat > /tmp/fs/init2 <<EOT
   2.205 -#!/bin/sh
   2.206 -
   2.207 -mount -t proc /proc /proc
   2.208 -for i in /lib/modules/*.ko*; do insmod \$i 2>/dev/null; done; sleep 2
   2.209 -v=\$(sed '/\\/home=/!d;s|.*/home=\\([^ ]*\\).*|\\1|' /proc/cmdline /cmdline 2>/dev/null)
   2.210 -mount / -o remount,rw
   2.211 -mkdir /mnt/dos
   2.212 -rm -f /cmdline 2>/dev/null
   2.213 -mount / -o remount,ro
   2.214 -mnt=/mnt/dos/\${v#*/}
   2.215 -dev=\$( (blkid /dev/[sh]d* || blkid) | grep \${v%%/*} | sed 's/:.*//;q')
   2.216 -echo "Mount \$dev in /mnt/dos for \$v..." | tee -a /run/boot.log
   2.217 -mount \$dev /mnt/dos
   2.218 -mount.posixovl -F \$mnt -- -oallow_other -odefault_permissions -osuid
   2.219 -mount --bind \$mnt /home
   2.220 -mount -o size=0,ro -t tmpfs tmpfs \$mnt
   2.221 -umount /proc
   2.222 -exec /sbin/init
   2.223 -EOT
   2.224 -	chmod 755 /tmp/fs/init?
   2.225 -	cp -a /tmp/fs/* /
   2.226 -	ln -s /sqfs/bin/gzip /bin 2>/dev/null
   2.227 -	( cd /tmp/fs; find * | cpio -o -H newc ) | gzip -9 >> $1
   2.228 -}
   2.229 -
   2.230 -mkinitrd()
   2.231 -{
   2.232 -	echo
   2.233 -	dotwait "Creating $(basename $1) "
   2.234 -	for i in bin lib dev proc tmp mnt etc; do
   2.235 -		mkdir -p /tmp/fs/$i
   2.236 -	done
   2.237 -	for i in /dev/console /dev/null /dev/tty /dev/tty[012] /dev/fuse /dev/[hs]d*; do
   2.238 -		cp -a $i /tmp/fs$i
   2.239 -	done
   2.240 -	for i in /bin/busybox $(which mount.posixovl) $(which blkid); do
   2.241 -		cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $i | \
   2.242 -		sed 's|.*=> \(.*/lib/l[^ ]*\).*|\1|;/^\//!d') /tmp/fs/lib
   2.243 -		cp $i /tmp/fs/bin
   2.244 -	done
   2.245 -	cp -a /sqfs/lib/ld-* /tmp/fs/lib 2>/dev/null ||
   2.246 -	cp -a /lib/ld-* /tmp/fs/lib
   2.247 -	for i in $(busybox | sed '/Current/,$!d'); do
   2.248 -		[ -e /tmp/fs/bin/${i%,} ] || ln -s busybox /tmp/fs/bin/${i%,}
   2.249 -	done
   2.250 -	ln -s /proc/mounts /tmp/fs/etc/mtab
   2.251 -	sed 's/ .*//' /proc/modules | while read mod; do
   2.252 -		find /lib/modules/ | grep $mod.ko | \
   2.253 -			sed 's|.*|cp & /tmp/fs/lib|' | sh
   2.254 -	done
   2.255 -	cat > /tmp/fs/init <<EOT
   2.256 -#!/bin/sh
   2.257 -
   2.258 -arg()
   2.259 -{
   2.260 -	grep -q \$1 /proc/cmdline &&
   2.261 -	val="\$(sed "s/.*\$1=\\([^ ]*\\).*/\\1/" < /proc/cmdline)" &&
   2.262 -	echo "\$2 \$val"
   2.263 -}
   2.264 -
   2.265 -mount -t proc /proc /proc
   2.266 -for i in /lib/*.ko*; do insmod \$i 2>/dev/null; done; sleep 2
   2.267 -arg mount "Mount device"
   2.268 -mount \$( (blkid /dev/[sh]d* || blkid) | grep \$val | sed 's/:.*//;q') /mnt
   2.269 -arg subroot "Change root to directory"
   2.270 -mount.posixovl -F /mnt/\$val -- -oallow_other -odefault_permissions -osuid
   2.271 -mount --bind /mnt /mnt/\$val/mnt/dos
   2.272 -mount -o size=0,ro -t tmpfs tmpfs /mnt/\$val/mnt/dos/\$val
   2.273 -LDSO=\$(ls /mnt/\$val/lib/ld-* | sed q)
   2.274 -export LD_LIBRARY_PATH=\$val/lib:\$val/usr/lib:/lib
   2.275 -umount /proc
   2.276 -exec /bin/switch_root /mnt \${LDSO#/mnt/} \$val/usr/sbin/chroot \$val /sbin/init
   2.277 -EOT
   2.278 -	chmod +x /tmp/fs/init
   2.279 -	( cd /tmp/fs; find * | cpio -o -H newc ) | lzma e $1 -si 2>/dev/null
   2.280 -	rm -rf /tmp/fs /tmp/wait
   2.281 -}
   2.282 -
   2.283 -is_loram()
   2.284 -{
   2.285 -	[ -s /lib/modules/squashfs.ko* ]
   2.286 -}
   2.287 -
   2.288 -ls_r()
   2.289 -{
   2.290 -	ls -r $@ 2>/dev/null || ls $@
   2.291 -}
   2.292 -
   2.293 -doinstall()
   2.294 -{
   2.295 -	mkdir -p /mnt/slitaz/boot /mnt/slitaz/mnt/dos
   2.296 -	if ! mount.posixovl -F /mnt/slitaz -- \
   2.297 -		-oallow_other -odefault_permissions -osuid; then
   2.298 -		echo "Can't install SliTaz. Abort."
   2.299 -		sleep 5
   2.300 -		return 1
   2.301 -	fi
   2.302 -	dotwait "Install root filesystem in /slitaz.."
   2.303 -	if [ "$1" ]; then
   2.304 -		if [ -d /media/cdrom/fs ]; then
   2.305 -			( cd /mnt/slitaz/fs; find | cpio -o -H newc ) | gzip -9
   2.306 -		else
   2.307 -			ls_r /media/cdrom/boot/rootfs* | xargs cat
   2.308 -		fi > /mnt/slitaz/boot/rootfs.gz
   2.309 -		tazusbinitfs /mnt/slitaz/boot/rootfs.gz
   2.310 -		initrd=rootfs.gz
   2.311 -		extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
   2.312 -	else
   2.313 -		if [ -d /media/cdrom/fs ]; then
   2.314 -			cp -a /media/cdrom/fs/. /mnt/slitaz
   2.315 -		elif is_loram; then
   2.316 -			for i in $(ls_r /media/cdrom/boot/rootfs*); do
   2.317 -				losetup -o 124 /dev/loop7 $i
   2.318 -				mount -t squashfs -o ro /dev/loop7 /sqfs/mnt
   2.319 -				cp -a /sqfs/mnt/. /mnt/slitaz
   2.320 -				umount /sqfs/mnt
   2.321 -				losetup -d /dev/loop7
   2.322 -			done
   2.323 -		else
   2.324 -			for i in $(ls_r /media/cdrom/boot/rootfs*); do
   2.325 -				uncpio $i /mnt/slitaz
   2.326 -			done
   2.327 -		fi
   2.328 -		mkinitrd /mnt/slitaz/boot/initrd
   2.329 -		initrd=initrd
   2.330 -		extraargs="mount=$(getuuid) subroot=slitaz"
   2.331 -	fi
   2.332 -	echo -en "\nInstall boot files..."
   2.333 -	for i in /media/cdrom/boot/bzImage /media/cdrom/boot/*pxe* \
   2.334 -		/media/cdrom/boot/isolinux/he* /media/cdrom/boot/isolinux/opt* \
   2.335 -		/media/cdrom/README /media/cdrom/boot/memtest*; do
   2.336 -		[ -s $i ] && cp $i /mnt/slitaz/boot
   2.337 -	done
   2.338 -	for i in /mnt/slitaz/boot/memtest /mnt/slitaz/boot/*pxe; do
   2.339 -		[ $(get 0 $i 2>/dev/null || echo 0) -eq 23117 ] &&
   2.340 -		mv $i $i.exe
   2.341 -	done
   2.342 -	cp /etc/keymap.conf /etc/locale.conf /mnt/slitaz/etc 2>/dev/null
   2.343 -	gettazboot /mnt/slitaz/boot/tazboot.exe
   2.344 -	unix2dos > /mnt/slitaz/boot/tazboot.cmd <<EOT
   2.345 -image=/slitaz/boot/bzimage
   2.346 -initrd=/slitaz/boot/$initrd
   2.347 -$extraargs autologin
   2.348 -EOT
   2.349 -	uudecode - <<EOT | gunzip > /mnt/slitaz/boot/slitaz.pif
   2.350 -begin-base64 644 -
   2.351 -H4sIAAAAAAACA8XPxUHGMBTA8X9ecb/glgFwv+FO23zeI+7ucMFhCjZgEEZh
   2.352 -Ctzd4Rf3PFbtQHGLG9BmfmZqdlE/tSmw2LfePzOzWDK0OsQXpPHvFGfZBmL5
   2.353 -f3Zns98NuG1BbTrbWj0OFMypSKfT4kYCurKuRleWlBEth2qUTYFBKjg746pI
   2.354 -2nZaIT/v9vWwbeuqi9fPznLlSPFLLuK22/0lLT09/BDhXgWKO1f9aLKxOObE
   2.355 -EhLuVvO4FksSwaH5qbHpvkle0TyzND82NK+doRVeZgGGbIw0XD2QwV9SnAN/
   2.356 -ACxDxwMAAA==
   2.357 -====
   2.358 -EOT
   2.359 -	unix2dos /mnt/slitaz/boot/he* /mnt/slitaz/boot/opt* \
   2.360 -		/mnt/slitaz/boot/README
   2.361 -	[ -d /mnt/slitaz/usr/sbin -a ! -x /mnt/slitaz/usr/sbin/mount.posixovl ] &&
   2.362 -	cp $(which mount.posixovl) /mnt/slitaz/usr/sbin
   2.363 -	rm -f /tmp/wait
   2.364 -false &&
   2.365 -	[ -s /mnt/boot.ini ] && ! grep -qs tazboot /mnt/boot.ini &&
   2.366 -	echo "Update boot.ini ..." && unix2dos >> /mnt/boot.ini <<EOT
   2.367 -C:\\slitaz\\boot\\tazboot.exe="SliTaz"
   2.368 -EOT
   2.369 -false &&
   2.370 -	grep -qis menuitem /mnt/config.sys && ! grep -qi tazboot /mnt/config.sys &&
   2.371 -	echo "Update config.sys ..." &&
   2.372 -	sed -i 's/menudefault/menuitem SLITAZ, SliTaz\r\n&/' /mnt/config.sys &&
   2.373 -	unix2dos >> /mnt/config.sys <<EOT
   2.374 -[SLITAZ]
   2.375 -install=\\slitaz\\boot\\tazboot.exe
   2.376 -EOT
   2.377 -	return 0
   2.378 -}
   2.379 -
   2.380 -install()
   2.381 -{
   2.382 -	$DIALOG --clear --title " SliTaz UMSDOS way installation " \
   2.383 -		--yes-label "Install" --yesno \
   2.384 -"\nSliTaz will be installed in the subdirectory \\slitaz of the current
   2.385 -DOS/Windows partition. You will see your files from /mnt/dos.\n\n
   2.386 -You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
   2.387 -To uninstall SliTaz, you have only to remove this directory.
   2.388 -The file \\boot.ini or \\config.sys may be modified too.\n\n
   2.389 -SliTaz may run slowly on the 'UMSDOS way' installation due to the
   2.390 -posixovl filesystem. The 'TAZUSB way' installation runs faster.\n\n
   2.391 -To do a traditional installation with disk partitioning,
   2.392 -start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
   2.393 -	[ $? -eq 0 ] || return
   2.394 -	doinstall || return
   2.395 -	[ -x /mnt/slitaz/sbin/init ] || return
   2.396 -	umount -d /media/cdrom
   2.397 -	umount_proc
   2.398 -	exec chroot /mnt/slitaz /sbin/init
   2.399 -}
   2.400 -
   2.401 -installtaz()
   2.402 -{
   2.403 -	$DIALOG --clear --title " SliTaz TAZUSB way installation " \
   2.404 -		--yes-label "Install" --yesno \
   2.405 -"\nSliTaz will be installed in the subdirectory \\slitaz of the current
   2.406 -DOS/Windows partition. You will see your files from /mnt/dos.\n\n
   2.407 -You can start SliTaz with \\slitaz\\boot\\tazboot.exe\n\n
   2.408 -To uninstall SliTaz, you have only to remove this directory.
   2.409 -The file \\boot.ini or \\config.sys may be modified too.\n\n
   2.410 -The filesystem is loaded entirely into memory upon boot to
   2.411 -increase responsiveness. Only /home lands on the hard disk.\n\n
   2.412 -To do a traditional installation with disk partitioning,
   2.413 -start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
   2.414 -	[ $? -eq 0 ] || return
   2.415 -	doinstall tazusblike || return
   2.416 -	dotwait
   2.417 -	if [ -d /media/cdrom/fs ]; then
   2.418 -		cp -a /media/cdrom/fs/. /
   2.419 -	else
   2.420 -		for i in $(ls_r /media/cdrom/boot/rootfs*); do
   2.421 -			uncpio $i
   2.422 -		done
   2.423 -	fi
   2.424 -	cp /tmp/fs/etc/* /etc 2>/dev/null
   2.425 -	echo "/home=$(getuuid)/slitaz" > /cmdline
   2.426 -	rm -f /tmp/wait
   2.427 -	[ -x /init1 ] || return
   2.428 -	umount -d /media/cdrom
   2.429 -	umount /mnt/slitaz
   2.430 -	rm -f /dev/cdrom
   2.431 -	umount /mnt
   2.432 -	mkdir /mnt/dos
   2.433 -	umount_proc
   2.434 -	exec /init1
   2.435 -}
   2.436 -
   2.437 -tazboot()
   2.438 -{
   2.439 -	$DIALOG --clear --title " SliTaz bootloader for DOS " \
   2.440 -		--yes-label "Install" --yesno \
   2.441 -"\nThe file TAZBOOT.EXE will be created in the top directory. It supports
   2.442 -any linux kernel, multiple initramfs, and a kernel command line.\n\n
   2.443 -Usage: tazboot.exe [[@commands]|[image=<bzimage>]
   2.444 -[initrd=<rootfs>[,<rootfs2>...]] cmdline args ...]\n\n
   2.445 -Defaults: tazboot @tazboot.cmd or tazboot image=bzImage auto\n\n\
   2.446 -Examples for tazboot.cmd:\n\n\
   2.447 -  image=boot/bzImage\n\
   2.448 -  initrd=boot/rootfs4.gz,boot/rootfs3.gz,boot/rootfs2.gz,boot/rootfs1.gz\n\
   2.449 -  autologin\n\n\
   2.450 -  image=\\slitaz\\vmlinuz root=/dev/sda5 ro\n" 24 78
   2.451 -	[ $? -eq 0 ] || return
   2.452 -	gettazboot /mnt/tazboot.exe
   2.453 -}
   2.454 -
   2.455 -md5()
   2.456 -{
   2.457 -	dotwait "Checking files"
   2.458 -	( cd /media/cdrom; ${1:-md5sum -c md5sum*} | sort ) > /tmp/data
   2.459 -	rm -f /tmp/wait
   2.460 -	$DIALOG --clear --title " Checked files " --textbox /tmp/data 24 78
   2.461 -	rm -f /tmp/data
   2.462 -}
   2.463 -
   2.464 -gotcdfile()
   2.465 -{
   2.466 -	for i in "/media/cdrom/$1" "/media/cdrom/*/$1" \
   2.467 -			"/media/cdrom/*/isolinux/$1"; do
   2.468 -		file=$(ls $i 2>/dev/null | sed q)
   2.469 -		[ -s "$file" ] && break
   2.470 -	done
   2.471 -}
   2.472 -
   2.473 -sha()
   2.474 -{
   2.475 -	gotcdfile "sha*sum*"
   2.476 -	sha=$(basename $file)
   2.477 -	md5 "${sha%sum*}sum -c ${file#/media/cdrom/}"
   2.478 -}
   2.479 -
   2.480 -readme()
   2.481 -{
   2.482 -	gotcdfile "README*"
   2.483 -	$DIALOG --clear --title " Readme " --textbox $file 24 78
   2.484 -}
   2.485 +tty0=tty0
   2.486  
   2.487  bootlog()
   2.488  {
   2.489 -	$DIALOG --clear --title " Linux boot messages " \
   2.490 +	dialog --clear --title " Linux boot messages " \
   2.491  		--textbox /tmp/dmesg 24 78
   2.492  }
   2.493  
   2.494 -bzimage()
   2.495 -{
   2.496 -	$DIALOG --clear --title " Create linux.exe ? " \
   2.497 -		--yes-label "Install" --yesno \
   2.498 -"\nLinux.exe launches the linux kernel under DOS (in real mode only).
   2.499 -The cmdline arguments are supported except initrd=,
   2.500 -vga= (you can try 'rdev -v') and mem= (partially).
   2.501 -\nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n
   2.502 -" 12 70
   2.503 -	[ $? -eq 0 ] || return
   2.504 -	cp /media/cdrom/boot/bzImage /mnt/linux.exe
   2.505 -}
   2.506 -
   2.507 -memtest()
   2.508 -{
   2.509 -	$DIALOG --clear --title " Create memtest.exe ? " \
   2.510 -		--yes-label "Install" --yesno \
   2.511 -"\nMemtest86 is a thorough, stand alone memory test for x86 architecture
   2.512 -computers. BIOS based memory tests are a quick, cursory check and often
   2.513 -miss many of the failures that are detected by Memtest86.\n" 12 70
   2.514 -	[ $? -eq 0 ] && gotcdfile "memtest*" && cp $file /mnt/memtest.exe
   2.515 -}
   2.516 -
   2.517 -mkfat12()
   2.518 -{
   2.519 -	[ $(($(get 0 $1) - 0x5A4D)) -eq 0 ] || return
   2.520 -	J=$(($(get 3 $1 1) + 0x02))
   2.521 -	R=$((1 + $(get 497 $1 1) + 1 + ($(get 500 $1)-1)/32))
   2.522 -	[ $R -lt 2500 ] || return
   2.523 -	[ $((($(get 500 $1)-1) & 31)) -lt 30 ] &&
   2.524 -	ddq if=$file bs=32 count=1 seek=$(($R*16 - 1)) of=/dev/fd0
   2.525 -	G="18 0 2 0 0 0 0 0"
   2.526 -	[ $J -gt 25 ] || G=""
   2.527 -	F=0
   2.528 -	for i in 1 2 3; do
   2.529 -		F=$((((2880-$R-$F-$F)*3+1023)/1024))
   2.530 -	done
   2.531 -	bytes2bin 0xEB $J 0x90 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 \
   2.532 -		0 2 2 $(($R%256)) $(($R/256)) 2 64 0 64 11 0xF0 $F 0 \
   2.533 -		$G | ddq bs=1 of=/dev/fd0
   2.534 -	ddq if=/dev/zero bs=512 count=$((4+$F+$F)) seek=$R of=/dev/fd0
   2.535 -	for i in $R $(($R+$F)); do
   2.536 -		bytes2bin 0xF0 0xFF 0xFF | ddq bs=512 seek=$i of=/dev/fd0
   2.537 -	done
   2.538 -	echo -n $(basename $1) | ddq bs=1 seek=3 count=8 of=/dev/fd0
   2.539 -}
   2.540 -
   2.541 -mkfloppy()
   2.542 -{
   2.543 -	dotwait "Create a $(basename $1 .exe) boot floppy"
   2.544 -	ddq if=$1 of=/dev/fd0
   2.545 -	mkfat12 $1
   2.546 -	rm -f /tmp/wait
   2.547 -}
   2.548 -
   2.549 -fdmemtest()
   2.550 -{
   2.551 -	$DIALOG --clear --title " Create a Memtest86 boot floppy " \
   2.552 -		--yes-label "Create floppy" --yesno \
   2.553 -"\nMemtest86 is a thorough, stand alone memory test for x86 architecture
   2.554 -computers. BIOS based memory tests are a quick, cursory check and often
   2.555 -miss many of the failures that are detected by Memtest86.\n\n
   2.556 -Please insert a blank disk in floppy drive.\n" 12 70
   2.557 -	[ $? -eq 0 ] && gotcdfile "memtest*" && mkfloppy $file
   2.558 -}
   2.559 -
   2.560 -pxe()
   2.561 -{
   2.562 -	gotcdfile "?pxe*"
   2.563 -	$DIALOG --clear --title " Create $(basename $file .exe).exe ? " \
   2.564 -		--yes-label "Install" --yesno \
   2.565 -"\nBoot your operating system from the internet and enjoy a full system
   2.566 -working entirely in RAM with speed and stability in mind. The Linux Kernel
   2.567 -and the complete SliTaz compressed root filesystem will be loaded into RAM
   2.568 -from the Web using PXE and HTTP protocols.\n" 12 70
   2.569 -	[ $? -eq 0 ] || return
   2.570 -	cp $file /mnt/$(basename $file .exe).exe
   2.571 -}
   2.572 -
   2.573 -fdpxe()
   2.574 -{
   2.575 -	$DIALOG --clear --title " Create a SliTaz Web boot floppy " \
   2.576 -		--yes-label "Create floppy" --yesno \
   2.577 -"\nBoot your operating system from the internet and enjoy a full system
   2.578 -working entirely in RAM with speed and stability in mind. The Linux Kernel
   2.579 -and the complete SliTaz compressed root filesystem will be loaded into RAM
   2.580 -from the Web using PXE and HTTP protocols.\n\n
   2.581 -Please insert a blank disk in floppy drive.\n" 12 70
   2.582 -	[ $? -eq 0 ] && gotcdfile "?pxe*" && mkfloppy $file
   2.583 -}
   2.584 -
   2.585  gotposixovl()
   2.586  {
   2.587  	mount.posixovl 2>&1 | grep -qi usage &&
   2.588  	echo -en "\"$1\"	\"$2\""
   2.589  }
   2.590  
   2.591 -xfile()
   2.592 -{
   2.593 -	[ "$(which $1)" ] && echo -en "\"$2\"	\"$3\""
   2.594 -}
   2.595 -
   2.596 -cdfile()
   2.597 -{
   2.598 -	gotcdfile "$1" && echo -en "\"$2\"	\"$3\""
   2.599 -}
   2.600 -
   2.601 -isbzImage()
   2.602 -{
   2.603 -	[ $(get 514 $file 4) -eq 1400005704 ] &&
   2.604 -	[ $(($(get 529 $file 1) & 1)) -eq 1 ]
   2.605 -}
   2.606 -
   2.607 -cdfilex()
   2.608 -{
   2.609 -	gotcdfile "$1" &&
   2.610 -	[ "$(which kexec)" ] &&
   2.611 -	isbzImage &&
   2.612 -	echo -en "\"$2\"	\"$3\""
   2.613 -}
   2.614 -
   2.615 -cdfilef()
   2.616 -{
   2.617 -	[ -e /sys/block/fd0 ] && cdfile "$@"
   2.618 -}
   2.619 -
   2.620 -cdexe()
   2.621 -{
   2.622 -	gotcdfile "$1" &&
   2.623 -	[ $(get 0 $file 2>/dev/null || echo 0) -eq 23117 ] &&
   2.624 -	echo -en "\"$2\"	\"$3\""
   2.625 -}
   2.626 -
   2.627 -fddata()
   2.628 -{
   2.629 -	[ -e /sys/block/fd0 ] &&
   2.630 -	[ $(get 26 /mnt/$ISO 1 2>/dev/null || echo 0) -ne 0 ] &&
   2.631 -	echo -en "\"$1\"	\"$2\""
   2.632 -}
   2.633 -
   2.634 -ishybrid()
   2.635 -{
   2.636 -	[ $(get 510 $ISO 2>/dev/null || echo 0) -eq 43605 ] || return
   2.637 -	C=$((2048*$(get $(((17*2048) + 71)) /mnt/$ISO 4)))