wok rev 23820

syslinux: merge init.exe & taziso
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 28 08:35:55 2020 +0000 (2020-05-28)
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)))
   2.638 -	[ $(get $C /mnt/$ISO 4) -eq 1 ] || return
   2.639 -	[ $(get $(($C+30)) /mnt/$ISO 4) -eq $((0x88AA55)) ] || return
   2.640 -	C=$((2048*$(get $(($C+40)) /mnt/$ISO 4)))
   2.641 -	[ $(get $(($C+64)) /mnt/$ISO 4) -eq 1886961915 ] &&
   2.642 -	echo -en "\"$1\"	\"$2\""
   2.643 -}
   2.644 -
   2.645 -burnable()
   2.646 -{
   2.647 -	[ "$(sed '/Can wr.*1$/!d' /proc/sys/dev/cdrom/info 2>/dev/null)" ] &&
   2.648 -	[ "$(which wodim)" ] && echo -en "\"$1\"	\"$2\""
   2.649 -}
   2.650 -
   2.651 -blankable()
   2.652 -{
   2.653 -	[ "$(sed '/Can wr.*RW.*1$/!d' /proc/sys/dev/cdrom/info 2>/dev/null)" ] &&
   2.654 -	[ "$(which wodim)" ] && echo -en "\"$1\"	\"$2\""
   2.655 -}
   2.656 -
   2.657 -burniso()
   2.658 -{
   2.659 -	wodim -v speed=$(fgrep "drive speed" /proc/sys/dev/cdrom/info | cut -f3) \
   2.660 -		-eject -multi "$ISO"
   2.661 -}
   2.662 -
   2.663 -blankcd()
   2.664 -{
   2.665 -	wodim -v -blank=fast
   2.666 -}
   2.667 -
   2.668 -customsector()
   2.669 -{
   2.670 -	echo $(get 32848 "/mnt/$ISO" 4)
   2.671 -}
   2.672 -
   2.673 -hascustomconf()
   2.674 -{
   2.675 -	[ "$(ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | ddq bs=1 count=6)" \
   2.676 -	  = "#!boot" ]
   2.677 -}
   2.678 -
   2.679 -gotcustomconf()
   2.680 -{
   2.681 -	hascustomconf && echo -en "\"$1\"	\"$2\""
   2.682 -}
   2.683 -
   2.684 -getcustomconf()
   2.685 -{
   2.686 -	cd ${1:-/mnt}
   2.687 -	ddq bs=2k skip=$(customsector) if="/mnt/$ISO" | while read line; do
   2.688 -		case "$line" in
   2.689 -		\#!boot*);;
   2.690 -		append=*) echo ${line#append=} > cmdline && ls -l cmdline;;
   2.691 -		initrd:*) cnt=${line#initrd:}
   2.692 -			  { ddq bs=512 count=$(($cnt / 512));
   2.693 -			    ddq bs=1 count=$(($cnt % 512)); } > initrd &&
   2.694 -			  ls -l initrd
   2.695 -			  break;;
   2.696 -		*)	  break;;
   2.697 -		esac
   2.698 -	done
   2.699 -	cd - > /dev/null
   2.700 -	[ -z "$1" ] && echo -e "\rPress RETURN to continue." && read n
   2.701 -}
   2.702 -
   2.703 -gotisomd5()
   2.704 -{
   2.705 -	[ "$(which md5sum 2>/dev/null)" ] &&
   2.706 -	[ $(get 0 /mnt/$ISO) -eq 23117 ] &&
   2.707 -	[ $(get 18 /mnt/$ISO) -ne 0 ] && echo -en "\"$1\"	\"$2\""
   2.708 -}
   2.709 -
   2.710 -isomd5()
   2.711 -{
   2.712 -	dotwait "Checking iso image"
   2.713 -	[ "$(ddq if=/mnt/$ISO bs=2k skip=16 \
   2.714 -	     count=$(($(get 32848 /mnt/$ISO 4)-16)) | md5sum)" = \
   2.715 -	  "$(ddq if=/mnt/$ISO bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | \
   2.716 -	     sed 's/ //g')  -" ] && echo "OK" || echo "ERROR"
   2.717 -	echo -en "\rChecking iso hybrid boot..."
   2.718 -	n=$(($(get 2 /mnt/$ISO)-1+($(get 4 /mnt/$ISO)-1)*512))
   2.719 -	if [ $n -lt 40000 -a $n -gt 32768 ]; then
   2.720 -		s=$(get 0 /mnt/$ISO 2 $n | awk '{ i+= $0 } END { print i }')
   2.721 -		[ $(((1+$s+$(get $(($n+1)) /mnt/$ISO 1)) % 65536)) -eq 0 ] &&
   2.722 -		echo "OK" || echo "ERROR"
   2.723 -	fi
   2.724 -	if hascustomconf; then
   2.725 -		echo -en "\rChecking iso custom config..."
   2.726 -		TMP=/tmp/$(basename $0)$$md5
   2.727 -		md5="$(ddq bs=2k skip=$(customsector) if=/mnt/$ISO | while read line; do
   2.728 -			case "$line" in
   2.729 -			\#!boot*) echo ${line#*boot } > $TMP;;
   2.730 -			append=*) echo $line;;
   2.731 -			initrd:*) echo $line
   2.732 -				  cnt=${line#initrd:}
   2.733 -				  ddq bs=512 count=$((cnt / 512))
   2.734 -				  ddq bs=1 count=$((cnt % 512))
   2.735 -				  break;;
   2.736 -			*)	  break;;
   2.737 -			esac
   2.738 -		done | md5sum | cut -c1-32)"
   2.739 -		[ "$md5" = "$(cat $TMP)" ] && echo "OK" || echo "ERROR"
   2.740 -		rm -f $TMP
   2.741 -	fi
   2.742 -	rm -f /tmp/wait
   2.743 -	echo -e "\rPress RETURN to continue."
   2.744 -	read n
   2.745 -}
   2.746 -
   2.747 -if [ "$1" = "--build" ]; then	#install-begin
   2.748 -	cp $0 $0.tmp
   2.749 -	uuencode -m - < header.com | sed -e '/^HEADERCODE$/r/dev/stdin' \
   2.750 -	  -e "s|HEADERSZ|$(stat -c %s header.com)|" -e '/^HEADERCODE$/d' -i $0.tmp
   2.751 -	uuencode -m - < ifmem.bin | sed -e 's|^[ \t]*||;s|[ \t]*###.*||' \
   2.752 -	  -e 's| *;;|;;|;s|\t\t*|\t|g' \
   2.753 -	  -e '/^ifmemcode$/r/dev/stdin' -e '/^ifmemcode$/d' -i $0.tmp
   2.754 -	uuencode -m - < bootloader.bin | sed -e '/^bootloader$/r/dev/stdin' \
   2.755 -	  -e '/^bootloader$/d' -e '/install-begin$/,/install-end$/d' -i $0.tmp
   2.756 -	mv -f $0.tmp $0; exit
   2.757 -fi	#install-end
   2.758 -parse_isolinux()
   2.759 -{
   2.760 -	awk 'BEGIN { IGNORECASE=1 }
   2.761 -function multi(n)
   2.762 -{
   2.763 -	auto=$n
   2.764 -	for (--n; n < NF; n+=2) {
   2.765 -		s=$n
   2.766 -		if (s ~ /M$/) s = substr(s,0,length(s)-1)
   2.767 -		else s /= 1024
   2.768 -		sizes=int(s) " " sizes
   2.769 -	}
   2.770 -	next
   2.771 -}
   2.772 -{
   2.773 -	if ($1 == "LABEL") {
   2.774 -		label=$2
   2.775 -		if (auto == "") auto=label
   2.776 -	}
   2.777 -	if ($1 == "KERNEL" || $1 == "COM32") kernel[label]=$2
   2.778 -	if ($1 == "INITRD") initrd[label]=$2
   2.779 -	if ($1 == "APPEND") {
   2.780 -		i=2
   2.781 -		if (kernel[label] ~ "ifmem.c32") multi(3)
   2.782 -		if (kernel[label] ~ "c32box.c32") {
   2.783 -			if ($2 == "linux") { kernel[label]=$3; i=4 }
   2.784 -			if ($2 == "ifmem") multi(4)
   2.785 -		}
   2.786 -		if (kernel[label] ~ "ifcpu64.c32") { auto=$4; next }
   2.787 -		while (i <= NF) {
   2.788 -			if ($i ~ "^initrd=") initrd[label]=substr($i,8)
   2.789 -			else cmdline[label]=cmdline[label] " " $i
   2.790 -			i++
   2.791 -		}
   2.792 -	}
   2.793 -}
   2.794 -END {
   2.795 -	print "KERNEL=\"" kernel[auto] "\""
   2.796 -	print "INITRD=\"" initrd[auto] "\""
   2.797 -	print "CMDLINE=\"" substr(cmdline[auto],2) "\""
   2.798 -	print "SIZES=\"" sizes "\""
   2.799 -}'
   2.800 -}
   2.801 -
   2.802 -locase()
   2.803 -{
   2.804 -	echo "$1" | tr [A-Z] [a-z]
   2.805 -}
   2.806 -
   2.807 -ifmemcode()
   2.808 -{
   2.809 -	uudecode <<EOT
   2.810 -ifmemcode
   2.811 -EOT
   2.812 -}
   2.813 -
   2.814 -floppyset()
   2.815 -{
   2.816 -	gotcdfile isolinux.cfg
   2.817 -	parse_isolinux < $file > /tmp/var$$
   2.818 -	. /tmp/var$$
   2.819 -	for i in /media/cdrom/$KERNEL $(dirname $file)/$KERNEL /media/cdrom/$(locase $KERNEL) \
   2.820 -		 $(dirname $file)/$(locase $KERNEL); do
   2.821 -		[ -s $i ] && KERNEL=$i && break
   2.822 -	done
   2.823 -	rm -f /tmp/var$$
   2.824 -	[ $(get 514 $KERNEL 4) -eq 1400005704 ] || return
   2.825 -	n=$(($(get 497 $KERNEL 1)+1))
   2.826 -	ddq bs=512 count=$n if=$KERNEL of=/tmp/fd$$
   2.827 -	uudecode <<EOT | ddq of=/tmp/fd$$ conv=notrunc
   2.828 -bootloader
   2.829 -EOT
   2.830 -	pos=$(($n*512))
   2.831 -	if [ -n "$CMDLINE" ]; then
   2.832 -		echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> /tmp/fd$$
   2.833 -		bytes2bin $n | ddq conv=notrunc \
   2.834 -			bs=1 seek=497 count=1 of=/tmp/fd$$
   2.835 -		words2bin $pos | ddq conv=notrunc \
   2.836 -			bs=1 seek=34 count=2 of=/tmp/fd$$
   2.837 -		[ $(get 518 $KERNEL 4) -ge 514 ] &&
   2.838 -		words2bin 32768 9 | ddq conv=notrunc \
   2.839 -			bs=1 seek=552 count=4 of=/tmp/fd$$
   2.840 -	fi
   2.841 -	syssize=$(echo $(get 500 /tmp/fd$$ 4))
   2.842 -	ddq bs=512 skip=$n if=$KERNEL | cat - /dev/zero | \
   2.843 -	ddq bs=512 count=$((($syssize+31)/32)) conv=sync >> /tmp/fd$$
   2.844 -	base=$(stat -c %s /tmp/fd$$)
   2.845 -	len=
   2.846 -	if [ "$INITRD" ]; then
   2.847 -		l=0
   2.848 -		for i in ${INITRD//,/ }; do
   2.849 -			for j in /media/cdrom/$i $(dirname $KERNEL)/$i /media/cdrom/$(locase $i) \
   2.850 -				 $(dirname $KERNEL)/$(locase $i); do
   2.851 -				[ -s $j ] && i=$j && break
   2.852 -			done
   2.853 -			ddq if=$i >> /tmp/fd$$
   2.854 -			l=$(($l+$(stat -c %s $i)))
   2.855 -			r=$((4 - ($l % 4)))
   2.856 -			if [ $r -ne 4 ]; then
   2.857 -				ddq if=/dev/zero bs=1 count=$r >> /tmp/fd$$
   2.858 -				l=$(($l + $r))
   2.859 -			fi
   2.860 -			case "$i:$INITRD" in
   2.861 -				*rootfs.gz:*rootfs.gz,*) continue	### loram
   2.862 -			esac
   2.863 -			len="$len $l"; l=0
   2.864 -		done
   2.865 -		rdadrs=${RDADRS:-$(((($syssize*16)+0x1F0000) & -4096))}
   2.866 -		words2bin $(($rdadrs & 0xFFFF)) $(($rdadrs >> 16)) | ddq \
   2.867 -			conv=notrunc bs=1 seek=536 count=4 of=/tmp/fd$$
   2.868 -	fi
   2.869 -	n=$(echo $len | wc -w)
   2.870 -	if [ $((494 - $(get 494 /tmp/fd$$))) -ge $(($n * 4)) ]; then
   2.871 -		i=$(($(get 494 /tmp/fd$$)))
   2.872 -		bytes2bin $(($i + ($n*4) - 256)) | ddq bs=1 conv=notrunc \
   2.873 -			seek=496 count=1 of=/tmp/fd$$
   2.874 -	else
   2.875 -		i=$(($pos + 0x1FC - ($n*4)))
   2.876 -		bytes2bin $(($i % 256)) $((i / 256)) 252 | ddq bs=1 \
   2.877 -			conv=notrunc seek=494 count=3 of=/tmp/fd$$
   2.878 -		s=$(($i - 2*$(echo "$SIZES" | wc -w)))
   2.879 -		p=$(($s - $(ifmemcode | wc -c)))
   2.880 -		ifmemcode | ddq bs=1 conv=notrunc seek=$p of=/tmp/fd$$
   2.881 -		words2bin $SIZES | ddq bs=1 conv=notrunc seek=$s of=/tmp/fd$$
   2.882 -		bytes2bin 154 $(($p%256)) $(($p/256)) 0 144 | \
   2.883 -		ddq bs=1 conv=notrunc seek=60 of=/tmp/fd$$
   2.884 -	fi
   2.885 -	for r in $len; do
   2.886 -		words2bin $(($r & 0xFFFF)) $(($r >> 16)) | ddq conv=notrunc \
   2.887 -			bs=1 seek=$i count=4 of=/tmp/fd$$
   2.888 -		i=$(($i + 4))
   2.889 -	done
   2.890 -	split -b 1440k /tmp/fd$$ fd$$
   2.891 -	rm -f /tmp/fd$$
   2.892 -	n=1; i=0; r=0
   2.893 -	set -- $len
   2.894 -	ls fd$$* | while read file; do
   2.895 -		if [ $i -gt $(($1+$base)) ]; then
   2.896 -			shift
   2.897 -			r=$(($r+100)); n=0; i=0; base=0
   2.898 -		fi
   2.899 -		ddq of=$file bs=18k seek=80 count=0
   2.900 -		i=$(($i+1474560))
   2.901 -		printf "mv %s fd%03d.img\n" $file $(($r+$n))
   2.902 -		n=$(($n+1))
   2.903 -	done | sh
   2.904 -	ls fd???.img
   2.905 -	mv fd???.img /mnt
   2.906 -}
   2.907 -
   2.908 -fdbootstrap()
   2.909 -{
   2.910 -	sz=$((512 * $(echo $(get 26 /mnt/$ISO 1))))
   2.911 -	$DIALOG --clear --title " Create a floppy bootstrap " \
   2.912 -		--yes-label "Continue" --yesno \
   2.913 -"\nThe floppy will install a driver to access the ISO file
   2.914 -on your hard disk and will emulate a CD-ROM during the boot process.\n\n
   2.915 -Please insert a floppy in drive now.\n" 10 70
   2.916 -	[ $? -eq 0 ] || return
   2.917 -	ddq if=/mnt/$ISO of=/tmp/bootiso bs=1 count=512 \
   2.918 -		skip=$(( $(get 64 /mnt/$ISO) - $sz ))
   2.919 -	echo "$ISO" | ddq of=/tmp/bootiso bs=512 seek=1 count=1
   2.920 -	ddq if=/mnt/$ISO of=/tmp/bootiso bs=1 count=$sz seek=2 \
   2.921 -		skip=$(( $(get 64 /mnt/$ISO) - $sz + 512 ))
   2.922 -	mkfloppy /tmp/bootiso
   2.923 -	rm -f /tmp/bootiso
   2.924 -}
   2.925 -
   2.926 -usbdev()
   2.927 -{
   2.928 -	dotwait "Wait 5 seconds for USB devices"
   2.929 -	sleep 5
   2.930 -	rm -f /tmp/wait
   2.931 -	DEV="$(grep -l 1 /sys/block/*/removable | \
   2.932 -		sed 's|/sys/block/\(.*\)/removable|\1|')"
   2.933 -	grep -qs 1 /sys/block/$DEV/ro && return
   2.934 -	[ "$DEV" ] || return
   2.935 -	cat > /tmp/dialog <<EOT
   2.936 -$DIALOG --clear --title " Select your USB key " \
   2.937 -	--menu "\nPlease select the USB key according to its known size.\n\n" \
   2.938 -	14 70 4 \
   2.939 -	$(for i in $DEV; do
   2.940 -		echo -n "/dev/$i \"$(($(cat /sys/block/$i/size)/2048))MB $(cat /sys/block/$i/device/model 2>/dev/null)\" "
   2.941 -	done)
   2.942 -EOT
   2.943 -	exec 3>&1
   2.944 -	device=$(. /tmp/dialog 2>&1 1>&3)
   2.945 -	retval=$?
   2.946 -	exec 3>&-
   2.947 -	[ $retval -eq 0 ]
   2.948 -}
   2.949 -
   2.950 -tazusbmsg()
   2.951 -{
   2.952 -	[ "$(which tazusb 2>/dev/null)" ] || return
   2.953 -	echo "You should choose 'USB key read/write installation' to be
   2.954 -able to save the package updates or your own configuration and data files.\n\n"
   2.955 -}
   2.956 -
   2.957 -usbbootkey()
   2.958 -{
   2.959 -	$DIALOG --clear --title " Create a USB boot key " \
   2.960 -		--yes-label "Continue" --yesno \
   2.961 -"\nThe USB key will be used like a CD-ROM. You will not be able to write
   2.962 -any data on the boot partition.\n\n
   2.963 -An extra FAT32 partition will be created with the remaining free space.\n\n
   2.964 -$(tazusbmsg)Please plug your USB stick in now.\n" 16 70
   2.965 -	[ $? -eq 0 ] || return
   2.966 -	usbdev || return
   2.967 -	
   2.968 -	### perform dd in progress bar
   2.969 -	max=$(($(cat /sys/block/loop0/size)/2048))
   2.970 -	i=0; ddq if=/mnt/$ISO bs=1024k | (
   2.971 -	while ddq bs=1024k count=1; do
   2.972 -		i=$(($i + 1))
   2.973 -		[ $i -gt $max ] && break
   2.974 -		echo $((($i*100)/$max)) | dialog --gauge \
   2.975 -			" The ISO image transfer can be long. Please wait..." \
   2.976 -			6 70 0 > /dev/tty0 2>&1
   2.977 -	done ) > $device
   2.978 -
   2.979 -	### partition + fat32 format for the remaining space
   2.980 -	for p in 0 16; do
   2.981 -		get $((450+$p)) $device 2 12 | xargs echo | {
   2.982 -		read dx cx ol oh ll lh
   2.983 -		[ $dx -eq $((0x3F17)) ] || continue
   2.984 -		cx=$(($cx & 0xFF00))
   2.985 -		ofs=$(($ll+($lh<<16)))
   2.986 -		n=$(($(cat /sys/block/${device#/dev/}/size)-$ofs))
   2.987 -		m=$(($cx+($n/8)))
   2.988 -		[ $m -gt $((0x3FF00)) ] && m=$((0x3FF00))
   2.989 -		m=$((($m & 0xFF00)+(($m>>16)<<6)))
   2.990 -		words2bin 0 $((0x101+$cx)) 0x3F0B $((32+$m)) \
   2.991 -			$ll $lh $(($n & 0xFFFF)) $(($n >> 16)) | \
   2.992 -			ddq bs=1 seek=$((462-$p)) of=$device
   2.993 -		if [ "$(which mkdosfs 2>/dev/null)" ]; then
   2.994 -			losetup -o $((512*$ofs)) /dev/loop2 $device
   2.995 -			mkdosfs -n "SLITAZ BOOT" /dev/loop2
   2.996 -			words2bin $(($ofs & 0xFFFF)) $(($ofs >> 16)) | \
   2.997 -				ddq bs=1 seek=28 of=/dev/loop2
   2.998 -			sync
   2.999 -			losetup -d /dev/loop2
  2.1000 -		fi
  2.1001 - 		}
  2.1002 - 	done
  2.1003 -}
  2.1004 -
  2.1005 -usbkey()
  2.1006 -{
  2.1007 -	$DIALOG --clear --title " Create a SliTaz USB key " \
  2.1008 -		--yes-label "Continue" --yesno \
  2.1009 -"\nUnlike a hard drive install, the filesystem is kept in a compressed
  2.1010 -rootfs.gz. The filesystem is loaded entirely into memory upon boot.
  2.1011 -This should increase responsiveness, protect the filesystem against
  2.1012 -accidental corruption and reduce read/writes to the USB drive.
  2.1013 -Once setup, the tazusb utility can rewrite the root filesystem
  2.1014 -with any changes you have made since booting up,
  2.1015 -giving the effective benefits of a hard drive install.\n\n
  2.1016 -/home is mounted on boot using the UUID of your particular flash drive.
  2.1017 -Unlike a device name, the UUID has the benefit of never changing from machine
  2.1018 -to machine.\n\n
  2.1019 -Please plug your USB stick in now.\n" 19 70
  2.1020 -	[ $? -eq 0 ] || return
  2.1021 -	usbdev || return
  2.1022 -	exec 3>&1
  2.1023 -	format=`$DIALOG --clear --title " Select the filesystem " \
  2.1024 -	--radiolist "\nPlease select the filesystem type to create.\n\n\
  2.1025 -The filesystem creation will erase all the data \
  2.1026 -in the USB key." 14 70 4 \
  2.1027 -		"none"	"Do not erase the USB key" on \
  2.1028 -		"ext3"	"Ext3 journaling filesystem" off \
  2.1029 -		"ext2"	"Ext2 filesystem" off \
  2.1030 -		"fat32"	"Windows FAT32 filesystem" off \
  2.1031 -	2>&1 1>&3`
  2.1032 -	retval=$?
  2.1033 -	exec 3>&-
  2.1034 -	[ $retval -eq 0 ] || return
  2.1035 -	[ "$format" != "none" ] && tazusb format $device "SliTaz" $format
  2.1036 -	tazusb gen-iso2usb /mnt/$ISO $device
  2.1037 -}
  2.1038 +myis_loram()                                                                   
  2.1039 +{                                                                            
  2.1040 +	[ -s /lib/modules/squashfs.ko* ]                                     
  2.1041 +}                                                                            
  2.1042  
  2.1043  mount_loram()
  2.1044  {
  2.1045 -	is_loram || return
  2.1046 +	myis_loram || return
  2.1047  	insmod /lib/modules/squashfs.ko* 2>/dev/null
  2.1048 -	if [ -d /media/cdrom/fs ]; then
  2.1049 -		ln -s /media/cdrom/fs /sqfs
  2.1050 +	if [ -d $media/fs ]; then
  2.1051 +		ln -s $media/fs /sqfs
  2.1052  	else
  2.1053  		mkdir /sqfs
  2.1054 -		losetup -o 124 /dev/loop6 $(ls_r /media/cdrom/boot/rootfs?*.* | sed q)
  2.1055 +		losetup -o 124 /dev/loop6 $(ls_r $media/boot/rootfs?*.* | sed q)
  2.1056  		mount -r /dev/loop6 /sqfs
  2.1057  	fi
  2.1058  	cp -a /sqfs/dev/fuse /sqfs/dev/tty[12] /sqfs/dev/[hs]d* /dev
  2.1059 @@ -1051,7 +102,7 @@
  2.1060  
  2.1061  umount_loram()
  2.1062  {
  2.1063 -	is_loram || return
  2.1064 +	myis_loram || return
  2.1065  	rm /var /usr
  2.1066  	umount -d /sqfs
  2.1067  	rmdir /sqfs 2>/dev/null || rm -f /sqfs
  2.1068 @@ -1062,15 +113,15 @@
  2.1069  {
  2.1070  	sync
  2.1071  	umount_loram
  2.1072 -	umount -d /media/cdrom
  2.1073 +	umount -d $media
  2.1074  	rm -f /dev/cdrom
  2.1075 -	umount /mnt
  2.1076 +	umount $mnt
  2.1077  	umount_proc
  2.1078  }
  2.1079  
  2.1080  text()
  2.1081  {
  2.1082 -	uncpio $(ls_r /media/cdrom/boot/rootfs?*.* | sed q)
  2.1083 +	$uncpio $(ls_r $media/boot/rootfs?*.* | sed q)
  2.1084  	init=
  2.1085  	cmdline="$(cat /proc/cmdline)"
  2.1086  	if hascustomconf; then
  2.1087 @@ -1078,7 +129,7 @@
  2.1088  		[ -s /tmp/cmdline ] &&
  2.1089  			cmdline="$cmdline $(cat /tmp/cmdline)" &&
  2.1090  			init="$(sed '/rdinit=/!d;s/.*rdinit=\([^ ]*\).*/\1/' < /tmp/cmdline)"
  2.1091 -		[ -s /tmp/initrd ] && uncpio /tmp/initrd
  2.1092 +		[ -s /tmp/initrd ] && $uncpio /tmp/initrd
  2.1093  	fi
  2.1094  	dosync
  2.1095  	sed -i 's/ || exit//' /init
  2.1096 @@ -1089,8 +140,8 @@
  2.1097  {
  2.1098  	n=0
  2.1099  	dotwait "Extract filesystem..."
  2.1100 -	for i in $(ls_r /media/cdrom/boot/rootfs*); do
  2.1101 -		[ $((n++)) -eq 0 ] || uncpio $i
  2.1102 +	for i in $(ls_r $media/boot/rootfs*); do
  2.1103 +		[ $((n++)) -eq 0 ] || $uncpio $i
  2.1104  	done
  2.1105  	rm -f /tmp/wait
  2.1106  	text
  2.1107 @@ -1125,45 +176,6 @@
  2.1108  	gotcdfile "?pxe*" && dokexec
  2.1109  }
  2.1110  
  2.1111 -flavdata()
  2.1112 -{
  2.1113 -	[ $(get 1024 /mnt/$ISO) -eq 35615 ] && n=2 ||
  2.1114 -	n=$((1+$(get 417 /mnt/$ISO 1)))
  2.1115 -	[ $n -eq 4 ] && n=20
  2.1116 -	[ $(get $(($n*512)) /mnt/$ISO) -eq 35615 ] || n=13
  2.1117 -	ddq if=/mnt/$ISO bs=512 skip=$n count=20 | zcat 2>/dev/null
  2.1118 -}
  2.1119 -
  2.1120 -hasflavinfo()
  2.1121 -{
  2.1122 -	[ "$(flavdata | ddq bs=1 count=7)" = "0707010" ] &&
  2.1123 -	echo -en "\"$1\"	\"$2\""
  2.1124 -}
  2.1125 -
  2.1126 -showfavinfo()
  2.1127 -{
  2.1128 -	mkdir -p /tmp/data
  2.1129 -	flavdata | ( cd /tmp/data; cpio -i )
  2.1130 -	file=/tmp/data/info
  2.1131 -	cat /tmp/data/*desc > $file
  2.1132 -	for i in /tmp/data/*list*; do
  2.1133 -		echo "=== extra ${i#*list} files"
  2.1134 -		cat $i
  2.1135 -	done >> $file
  2.1136 -	$DIALOG --clear --title " Flavor info " --textbox $file 24 78
  2.1137 -	rm -rf /tmp/data
  2.1138 -}
  2.1139 -
  2.1140 -flavor()
  2.1141 -{
  2.1142 -	cd /mnt
  2.1143 -	name="$(flavdata | cpio -t 2>/dev/null | sed 's/.[a-z]*$//;q')"
  2.1144 -	echo "Create ${name:=flavor}.flavor..."
  2.1145 -	tazlito iso2flavor "/mnt/$ISO" $name
  2.1146 -	ls -l $name.flavor 2>/dev/null || sleep 5
  2.1147 -	cd - > /dev/null
  2.1148 -}
  2.1149 -
  2.1150  shell()
  2.1151  {
  2.1152  	trap text 2
  2.1153 @@ -1184,59 +196,6 @@
  2.1154  ISO="$(getarg bootfrom | sed 's/.://;s|\\|/|g')"
  2.1155  getiso 2>/dev/null || text
  2.1156  mount_loram
  2.1157 -case "${ISO##*/}$(getarg mode)" in
  2.1158 -*install*|*INSTALL*)	install;;
  2.1159 -*live*|*LIVE*)		live;;
  2.1160 -*text*|*TEXT*)		text;;
  2.1161 -esac
  2.1162 -which $DIALOG 2>/dev/null || DIALOG=tinydialog
  2.1163 -dmesg > /tmp/dmesg
  2.1164 +[ -s /usr/bin/taziso ] || live
  2.1165  
  2.1166 -isotitle="$(blkid /mnt/$ISO | sed 's/.*LABEL="\([^"]*\).*/\1/')  $(stat \
  2.1167 -	 -c %y /media/cdrom | sed 's/ .*//')  $(basename $ISO)"
  2.1168 -while true; do
  2.1169 -	trap shell 2
  2.1170 -	keymap="$(cat /etc/keymap.conf 2>/dev/null)"
  2.1171 -	locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)"
  2.1172 -	cat > /tmp/dialog <<EOT
  2.1173 -$DIALOG --clear --title " ${isotitle:-Welcome to Linux} " \
  2.1174 -	--menu "" 23 70 17 \
  2.1175 -$(xfile tazkeymap	"tazkeymap"	"Select keyboard (${keymap:-none})") \
  2.1176 -$(xfile tazlocale	"tazlocale"	"Select locale (${locale:-none})") \
  2.1177 -$(cdfile boot/bzImage	"live"		"Linux RAM boot (full desktop)") \
  2.1178 -			"text"		"Linux RAM boot" \
  2.1179 -$(cdfile "README*"	"readme"	"Show the README file") \
  2.1180 -$(gotcustomconf		"getcustomconf"	"Get custom config") \
  2.1181 -$(gotisomd5		"isomd5"	"Check the ISO image") \
  2.1182 -$(cdfile "md5sum*"	"md5"		"Check the ISO files") \
  2.1183 -$(cdfile "sha*sum*"	"sha"		"Check the ISO files") \
  2.1184 -$(burnable		"burniso"	"Burn the ISO image") \
  2.1185 -$(blankable		"blankcd"	"Blank the CD/DVD") \
  2.1186 -$(gotposixovl		"install"	"Hard disk installation (UMSDOS way)") \
  2.1187 -$(gotposixovl		"installtaz"	"Hard disk installation (TAZUSB way)") \
  2.1188 -$(xfile tazusb		"usbkey"	"USB key read/write installation") \
  2.1189 -$(ishybrid		"usbbootkey"	"USB boot key (read only)") \
  2.1190 -$(hasflavinfo		"showfavinfo"	"Show flavor extra info") \
  2.1191 -$(xfile tazlito		"flavor"	"Get flavor file") \
  2.1192 -$(fddata		"fdbootstrap"	"Create a floppy bootstrap") \
  2.1193 -$(cdfile isolinux.cfg	"floppyset"	"Boot floppy set") \
  2.1194 -$(cdfile linld.com	"tazboot"	"Get tazboot.exe Linux loader") \
  2.1195 -$(cdexe boot/bzImage	"bzimage"	"Get linux DOS/EXE file") \
  2.1196 -$(cdexe "memtest*"	"memtest"	"Get Memtest86 DOS/EXE file") \
  2.1197 -$(cdfilef "memtest*"	"fdmemtest"	"Create a Memtest86 boot floppy") \
  2.1198 -$(:||cdfilex "memtest*"	"runmemtest"	"Start Memtest86") \
  2.1199 -$(cdexe "?pxe*"		"pxe"		"Get SliTaz Web boot DOS/EXE utility") \
  2.1200 -$(cdfilef "?pxe*"	"fdpxe"		"Create a SliTaz Web boot floppy") \
  2.1201 -$(:||cdfilex "?pxe*"	"runpxe"	"Start the SliTaz Web boot utility") \
  2.1202 -$(xfile reboot		"restart"	"Restart the computer") \
  2.1203 -$(xfile poweroff	"stop"		"Power off") \
  2.1204 -			"bootlog"	"Linux boot messages" \
  2.1205 -			"shell"		"Shell prompt"
  2.1206 -EOT
  2.1207 -	exec 3>&1
  2.1208 -	value=$(. /tmp/dialog 2>&1 1>&3)
  2.1209 -	retval=$?
  2.1210 -	exec 3>&-
  2.1211 -	[ $retval -eq 0 ] || continue
  2.1212 -	$value
  2.1213 -done
  2.1214 +. /usr/bin/taziso
     3.1 --- a/syslinux/stuff/iso2exe/taziso	Wed May 27 17:52:58 2020 +0100
     3.2 +++ b/syslinux/stuff/iso2exe/taziso	Thu May 28 08:35:55 2020 +0000
     3.3 @@ -46,23 +46,25 @@
     3.4  
     3.5  uncpio()
     3.6  {
     3.7 -	[ -s "$1" ] || return
     3.8 -	echo -en "\n Extracting $(basename $1) ..."
     3.9 -	case $(get 0 $1) in
    3.10 +	i=$1                                                    
    3.11 +	[ $0 = /init.exe ] && sed 's|$| |' /proc/cpuinfo | grep ' lm ' && [ -s ${i}64 ] && i=${i}64
    3.12 +	[ -s "$i" ] || return
    3.13 +	echo -en "\n Extracting $(basename $i) ..."
    3.14 +	case $(get 0 $i) in
    3.15  	*35615)	( zcat || gunzip ) ;;
    3.16  	*14333) unxz ;;
    3.17  	*\ 93)	unlzma ;;
    3.18  	*)	cat ;;
    3.19 -	esac < $1 | ( cd ${2:-/} ; cpio -idmu > /dev/null 2>&1 )
    3.20 +	esac < $i | ( cd ${2:-/} ; cpio -idmu > /dev/null 2>&1 )
    3.21  }
    3.22  
    3.23  dotwait()
    3.24  {
    3.25  	echo -n "${1:-Install filesystem}.."
    3.26 -	touch /tmp/wait
    3.27 +	echo -n > /tmp/wait
    3.28  	[ "$REQUEST_URI" ] && return
    3.29  	while [ -e /tmp/wait ]; do
    3.30 -		echo -n "." > /dev/tty
    3.31 +		echo -n "." > /dev/${tty0:-tty}
    3.32  		sleep 1
    3.33  	done &
    3.34  }
    3.35 @@ -200,6 +202,11 @@
    3.36  	ls -r $@ 2> /dev/null || ls $@
    3.37  }
    3.38  
    3.39 +is_loram()                                                                   
    3.40 +{                                                                            
    3.41 +	[ -s /lib/modules/squashfs.ko* ]                                     
    3.42 +}                                                                            
    3.43 +
    3.44  doinstall()
    3.45  {
    3.46  	unset useposixovl
    3.47 @@ -224,9 +231,21 @@
    3.48  		initrd=rootfs.gz
    3.49  		extraargs="/home=$(getuuid)/slitaz rdinit=/init1"
    3.50  	else
    3.51 -		for i in $(ls_r $media/boot/rootfs*gz); do
    3.52 -			uncpio $i $mnt/slitaz
    3.53 -		done
    3.54 +		if [ -d $media/fs ]; then                                
    3.55 +                        cp -a $media/fs/. $mnt/slitaz                    
    3.56 +                elif is_loram; then                                            
    3.57 +                        for i in $(ls_r $media/boot/rootfs*); do         
    3.58 +                                losetup -o 124 /dev/loop7 $i                   
    3.59 +                                mount -t squashfs -o ro /dev/loop7 /sqfs/mnt   
    3.60 +                                cp -a /sqfs/mnt/. $mnt/slitaz                  
    3.61 +                                umount /sqfs/mnt                               
    3.62 +                                losetup -d /dev/loop7                          
    3.63 +                        done                                                   
    3.64 +                else
    3.65 +			for i in $(ls_r $media/boot/rootfs*gz); do
    3.66 +				${uncpio:-uncpio} $i $mnt/slitaz
    3.67 +			done
    3.68 +		fi
    3.69  		for i in $packages_list; do
    3.70  			tazpkg get-install $i --root=$mnt/slitaz
    3.71  		done
    3.72 @@ -311,7 +330,20 @@
    3.73  
    3.74  EOT
    3.75  	fi
    3.76 -	rm -f /tmp/wait
    3.77 +false &&                                                                          
    3.78 +	[ -s $mnt/boot.ini ] && ! grep -qs tazboot $mnt/boot.ini &&               
    3.79 +	echo "Update boot.ini ..." && unix2dos >> $mnt/boot.ini <<EOT             
    3.80 +C:\\slitaz\\boot\\tazboot.exe="SliTaz"                                                
    3.81 +EOT                                                                               
    3.82 +false &&                                                                          
    3.83 +	grep -qis menuitem $mnt/config.sys && ! grep -qi tazboot $mnt/config.sys &&
    3.84 +	echo "Update config.sys ..." &&                                            
    3.85 +	sed -i 's/menudefault/menuitem SLITAZ, SliTaz\r\n&/' $mnt/config.sys &&    
    3.86 +	unix2dos >> $mnt/config.sys <<EOT                                          
    3.87 +[SLITAZ]                                                                           
    3.88 +install=\\slitaz\\boot\\tazboot.exe                                                
    3.89 +EOT
    3.90 +	rm -f $tmp/wait
    3.91  	[ "$useposixovl" ] && umount $mnt/slitaz
    3.92  	return 0
    3.93  }
    3.94 @@ -349,6 +381,7 @@
    3.95  {
    3.96  	packages_list=
    3.97  	packages_dir=
    3.98 +	[ $0 = /init.exe ] && return
    3.99  	$DIALOG --clear --title " Extra packages " \
   3.100  		--defaultno --yesno \
   3.101  "Do you want to add extra packages ?" 7 70
   3.102 @@ -393,6 +426,11 @@
   3.103  start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
   3.104  	[ $? -eq 0 ] || return
   3.105  	doinstall
   3.106 +	[ $0 = /init.exe ] || return
   3.107 +	[ -x $mnt/slitaz/sbin/init ] || return
   3.108 +	umount -d $media/cdrom
   3.109 +	umount_proc
   3.110 +	exec chroot $mnt/slitaz /sbin/init
   3.111  }
   3.112  
   3.113  readtazbootconf()
   3.114 @@ -520,7 +558,27 @@
   3.115  To do a traditional installation with disk partitioning,
   3.116  start SliTaz Live with the 'SliTaz RAM boot' menu.\n" 19 70
   3.117  	[ $? -eq 0 ] || return
   3.118 -	doinstall tazusblike
   3.119 +	doinstall tazusblike || return
   3.120 +	[ $0 = /init.exe ] || return
   3.121 +	dotwait
   3.122 +	if [ -d /media/cdrom/fs ]; then
   3.123 +		cp -a /media/cdrom/fs/. /
   3.124 +	else
   3.125 +		for i in $(ls_r /media/cdrom/boot/rootfs*); do
   3.126 +			${uncpio:-uncipo} $i
   3.127 +		done
   3.128 +	fi
   3.129 +	cp /tmp/fs/etc/* /etc 2>/dev/null
   3.130 +	echo "/home=$(getuuid)/slitaz" > /cmdline
   3.131 +	rm -f /tmp/wait
   3.132 +	[ -x /init1 ] || return
   3.133 +	umount -d /media/cdrom
   3.134 +	umount /mnt/slitaz
   3.135 +	rm -f /dev/cdrom
   3.136 +	umount /mnt
   3.137 +	mkdir /mnt/dos
   3.138 +	umount_proc
   3.139 +	exec /init1
   3.140  }
   3.141  
   3.142  installtaz()
   3.143 @@ -755,11 +813,26 @@
   3.144  	[ "$(which zip)" ] && gotposixovl "$1" "$2"
   3.145  }
   3.146  
   3.147 +noinit()
   3.148 +{
   3.149 +	[ $0 = /init.exe ] || menuitem "$@"
   3.150 +}
   3.151 +
   3.152 +initx()
   3.153 +{
   3.154 +	[ $0 = /init.exe ] && menuitem "$@"
   3.155 +}
   3.156 +
   3.157  xfile()
   3.158  {
   3.159  	[ "$(which $1)" ] && menuitem "$@"
   3.160  }
   3.161  
   3.162 +initxfile()
   3.163 +{
   3.164 +	[ $0 = /init.exe ] && xfile "$@"
   3.165 +}
   3.166 +
   3.167  cdfile()
   3.168  {
   3.169  	gotcdfile "$1" && menuitem "$@"
   3.170 @@ -802,6 +875,11 @@
   3.171  	done
   3.172  }
   3.173  
   3.174 +noinitmisspkg()
   3.175 +{
   3.176 +	[ $0 = /init.exe ] || misspkg "$@"
   3.177 +}
   3.178 +
   3.179  missing()
   3.180  {
   3.181  	misspkg install
   3.182 @@ -1323,6 +1401,17 @@
   3.183  		-c %y $media/.|sed 's/ .*//')  $(basename "$ISO")"
   3.184  }
   3.185  
   3.186 +	if [ $0 = /init.exe ]; then
   3.187 +
   3.188 +case "${ISO##*/}$(getarg mode)" in
   3.189 +*install*|*INSTALL*)	install;;
   3.190 +*live*|*LIVE*)		live;;
   3.191 +*text*|*TEXT*)		text;;
   3.192 +esac
   3.193 +dmesg > /tmp/dmesg
   3.194 +
   3.195 +	else
   3.196 +
   3.197  if [ "$1" = "include" ]; then
   3.198  	[ -s "$2" ] && cd $(dirname "$2") && awk -v exe=$0 \
   3.199  	'{ if ($1 == "include") system(exe " include " $2); else print }' <"$2"
   3.200 @@ -1354,10 +1443,17 @@
   3.201  	fi
   3.202  	quit
   3.203  fi
   3.204 +	fi
   3.205  
   3.206  while true; do
   3.207 +	keymap="$(cat /etc/keymap.conf 2>/dev/null)"
   3.208 +	locale="$(sed '/^LANG=/!d;s/.*=//' /etc/locale.conf 2>/dev/null)"
   3.209  	cat > /tmp/dialog$$ <<EOT
   3.210  $DIALOG  --clear --title " $(isotitle) " --menu "" 28 70 30 \
   3.211 +$(initxfile tazkeymap	"tazkeymap"	"Select keyboard (${keymap:-none})") \
   3.212 +$(initxfile tazlocale	"tazlocale"	"Select locale (${locale:-none})") \
   3.213 +$(initx			"live"		"Linux RAM boot (full desktop)") \
   3.214 +$(initx			"text"		"Linux RAM boot") \
   3.215  $(cdfile 'README*'	"readme"	"Show the README file") \
   3.216  $(gotcustomconf		"getcustomconf"	"Get custom config") \
   3.217  $(gotisomd5		"isomd5"	"Check the ISO image") \
   3.218 @@ -1384,14 +1480,18 @@
   3.219  $(cdexe '?pxe*'		"pxe"		"Get SliTaz Web boot DOS/EXE utility") \
   3.220  $(cdfilef '?pxe*'	"fdpxe"		"Create a SliTaz Web boot floppy") \
   3.221  $(cdfilex '?pxe*'	"runpxe"	"Start the SliTaz Web boot utility") \
   3.222 -$(misspkg		"missing"	"Install packages to get more options") \
   3.223 -$(menuitem		"quit"		"Quit this utility")
   3.224 +$(initxfile reboot	"restart"	"Restart the computer") \
   3.225 +$(initxfile poweroff	"stop"		"Power off") \
   3.226 +$(initx			"bootlog"       "Linux boot messages") \
   3.227 +$(initx			"shell"         "Shell prompt") \
   3.228 +$(noinitmisspkg		"missing"	"Install packages to get more options") \
   3.229 +$(noinit		"quit"		"Quit this utility")
   3.230  EOT
   3.231  	exec 3>&1
   3.232  	value=$(. /tmp/dialog$$ 2>&1 1>&3)
   3.233  	retval=$?
   3.234  	exec 3>&-
   3.235  	rm -f /tmp/dialog$$
   3.236 -	[ $retval -eq 0 ] || quit
   3.237 +	[ $retval -ne 0 ] && [ $0 != /init.exe ] && quit
   3.238  	$value
   3.239  done
     4.1 --- a/syslinux/stuff/iso2exe/win32.c	Wed May 27 17:52:58 2020 +0100
     4.2 +++ b/syslinux/stuff/iso2exe/win32.c	Thu May 28 08:35:55 2020 +0000
     4.3 @@ -314,7 +314,8 @@
     4.4  		if (MessageBox(NULL,
     4.5  			"This program must be run in DOS mode.\n"
     4.6  			"I can create the file slitaz.pif to launch it,\n"
     4.7 -			"but you can reboot in DOS mode to run it.\n",
     4.8 +			"but you can reboot in DOS mode to run it.\n"
     4.9 +			"\nDo you want to create the slitaz.pif file and execute it now ?",
    4.10  			"Create slitaz.pif now ?",
    4.11  			MB_YESNO|MB_ICONQUESTION) == IDYES) {
    4.12  			exec16bits(isoFileName);