wok diff syslinux/stuff/iso2exe/init @ rev 17569

syslinux/iso2exe/init: fix reboot
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 07 20:40:28 2015 +0100 (2015-02-07)
parents 00bb1e4137c6
children 52c9cc2da3c6
line diff
     1.1 --- a/syslinux/stuff/iso2exe/init	Sat Feb 07 15:39:46 2015 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/init	Sat Feb 07 20:40:28 2015 +0100
     1.3 @@ -23,6 +23,17 @@
     1.4  	echo -e "\x1B[1;1H\x1B[J"
     1.5  }
     1.6  
     1.7 +xless()
     1.8 +{
     1.9 +	[ $(wc -l < "$1") -gt 22 ] &&
    1.10 +	sed 's/..3.;4.m/===/g;$s/.*/&\n---\nPress q to continue/' "$1" | less ||
    1.11 +	{	cat "$1"
    1.12 +		[ "$2" ] || return
    1.13 +		echo -e "$2"
    1.14 +		read n
    1.15 +	}
    1.16 +}
    1.17 +
    1.18  tinydialog()
    1.19  {
    1.20  	clear
    1.21 @@ -33,7 +44,7 @@
    1.22  			 echo -e $title; shift ;;
    1.23  		--yes-label) label="$2" ; shift ;;
    1.24  		--textbox)
    1.25 -			less "$2" < /dev/tty0 > /dev/tty0
    1.26 +			xless "$2" "\nPress RETURN to continue."
    1.27  			break;;
    1.28  		--gauge)
    1.29  			t="        "
    1.30 @@ -70,9 +81,7 @@
    1.31  			done >> /tmp/data
    1.32  			while ! grep -q "^$n	" /tmp/data ; do
    1.33  				clear
    1.34 -				[ $(wc -l < /tmp/data) -gt 22 ] && 
    1.35 -				sed 's/..3.;4.m/===/g;$aPress q to continue' \
    1.36 -				/tmp/data | less || cat /tmp/data
    1.37 +				xless /tmp/data
    1.38  				echo -en "\n   <- Enter the selection number\r"
    1.39  				read n
    1.40  			done 2> /dev/null
    1.41 @@ -103,16 +112,15 @@
    1.42  bytes2bin()
    1.43  {
    1.44  	for i in $@ ; do
    1.45 -		printf '\\\\x%02X' $(($i&255)) | xargs echo -en
    1.46 -	done
    1.47 +		printf '\\\\x%02X' $(($i&255))
    1.48 +	done | xargs echo -en
    1.49  }
    1.50  
    1.51  words2bin()
    1.52  {
    1.53  	for i in $@ ; do
    1.54 -		printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255)) | \
    1.55 -			xargs echo -en
    1.56 -	done
    1.57 +		printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255))
    1.58 +	done | xargs echo -en
    1.59  }
    1.60  
    1.61  gettazboot()
    1.62 @@ -493,8 +501,9 @@
    1.63  		--title " Create linux.exe ? " \
    1.64  		--yes-label "Install" --yesno \
    1.65  "\nLinux.exe launches the linux kernel under DOS (in real mode only).
    1.66 -The cmdline arguments are supported except initrd=, vga= (you can try 'rdev -v')
    1.67 -and mem= (partially).\n\nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n
    1.68 +The cmdline arguments are supported except initrd=,
    1.69 +vga= (you can try 'rdev -v') and mem= (partially).
    1.70 +\nExample:\nC:\\> linux.exe root=/dev/hda2 ro panic=60\n
    1.71  " 12 70
    1.72  	[ $? -eq 0 ] || return
    1.73  	cp /media/cdrom/boot/bzImage /mnt/linux.exe
    1.74 @@ -820,13 +829,19 @@
    1.75  	rmdir /sqfs
    1.76  }
    1.77  
    1.78 -text()
    1.79 +dosync()
    1.80  {
    1.81 +	sync
    1.82  	umount_loram
    1.83  	umount -d /media/cdrom
    1.84  	rm -f /dev/cdrom
    1.85  	umount /mnt
    1.86  	umount_proc
    1.87 +}
    1.88 +
    1.89 +text()
    1.90 +{
    1.91 +	dosync
    1.92  	exec /init
    1.93  }
    1.94  
    1.95 @@ -842,12 +857,6 @@
    1.96  	text
    1.97  }
    1.98  
    1.99 -dosync()
   1.100 -{
   1.101 -	sync
   1.102 -	[ ! -L /sqfs ] && umount -d /media/cdrom && umount /mnt
   1.103 -}
   1.104 -
   1.105  restart()
   1.106  {
   1.107  	dosync