wok diff syslinux/stuff/iso2exe/iso2exe.sh @ rev 20859

Update some WEB_SITE
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Feb 22 10:45:05 2019 +0100 (2019-02-22)
parents 01b30edcef4e
children 2cb24e6379d5
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Sat Feb 16 12:52:08 2019 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Fri Feb 22 10:45:05 2019 +0100
     1.3 @@ -8,6 +8,7 @@
     1.4  store()
     1.5  {
     1.6  	local i
     1.7 +	local n
     1.8  	n=$2; for i in $(seq 8 8 ${4:-16}); do
     1.9  		printf '\\\\x%02X' $(($n & 255))
    1.10  		n=$(($n >> 8))
    1.11 @@ -83,36 +84,29 @@
    1.12  add_win32exe()
    1.13  {
    1.14  	SIZE=$($0 --get win32.exe 2> /dev/null | tee /tmp/exe$$ | wc -c)
    1.15 -	[ -n "$gpt" ] && SIZE=$(($SIZE+1024))
    1.16 -	[ -n "$mac" ] && SIZE=$(($SIZE+3072))
    1.17 +	[ -n "$gpt" ] && n=1536 || n=512
    1.18 +	SIZE=$(($SIZE+$n))
    1.19  	printf "Adding WIN32 file at %04X (%d bytes) ...\n" 0 $SIZE
    1.20 -	ddq if=/tmp/exe$$ of=$1 conv=notrunc
    1.21 -	if [ -n "$gpt" ]; then
    1.22 -		printf "Adding GPT at %04X (1024 bytes) ...\n" 512
    1.23 -		ddq if=$2 bs=512 skip=1 of=$1 seek=1 conv=notrunc
    1.24 -		i=3; [ -n "$mac" ] && i=9
    1.25 -		ddq if=/tmp/exe$$ bs=512 skip=1 of=$1 seek=$i conv=notrunc
    1.26 -		OFS=$((512*($i-1)))
    1.27 -		for i in 18C 1B4 1DC ; do	# always 3 UPX sections
    1.28 -			store $((0x$i)) $(($OFS + $(get 0x$i $1))) $1
    1.29 -		done
    1.30 -	fi
    1.31 +	[ -n "$gpt" ] && printf "Adding GPT at %04X (1024 bytes) ...\n" 512
    1.32 +	for i in $(seq 396 40 $((356+$(get 0x86 /tmp/exe$$)*40))); do
    1.33 +		x=$(($n + $(get $i /tmp/exe$$)))
    1.34 +		store $(($i)) $x /tmp/exe$$	### section offset
    1.35 +	done
    1.36 +	cut=$((0x98+$(get 0x94 /tmp/exe$$)))	### end of header
    1.37 +	store $((0x94)) $(($n + $cut - 0x98)) /tmp/exe$$
    1.38 +	ddq if=/tmp/exe$$ of=$1 conv=notrunc bs=1 count=$cut
    1.39 +	ddq if=/tmp/exe$$ of=$1 conv=notrunc bs=1 skip=$cut seek=$(($n+$cut))
    1.40  	printf "Adding bootiso head at %04X...\n" 0
    1.41  	$0 --get bootiso.bin 2> /dev/null > /tmp/exe$$
    1.42 -	ddq if=/tmp/exe$$ of=$1 bs=128 count=1 conv=notrunc
    1.43 -	store $((0x94)) $((0xE0 - 12*8)) $1
    1.44 -	store $((0xF4)) $((16 - 12)) $1
    1.45 -	ddq if=$1 of=/tmp/coff$$ bs=1 skip=$((0x178)) count=$((0x88))
    1.46 -	ddq if=/tmp/coff$$ of=$1 conv=notrunc bs=1 seek=$((0x178 - 12*8))
    1.47 +	ddq if=/tmp/exe$$ of=$1 bs=128 count=1 conv=notrunc	### DOS stub
    1.48  	ddq if=/tmp/exe$$ of=$1 bs=1 count=24 seek=$((0x1A0)) skip=$((0x1A0)) conv=notrunc
    1.49  	ddq if=$2 bs=1 skip=$((0x1B8)) seek=$((0x1B8)) count=72 of=$1 conv=notrunc
    1.50  	store 510 $((0xAA55)) $1
    1.51  	i=$SIZE; OFS=$(($SIZE+512))
    1.52 -	[ -n "$mac" ] && OFS=$SIZE && i=1536
    1.53 -	store 417 $(($i/512)) $1 8
    1.54 +	store 417 $(($i/512)) $1 8	### isolinux boot sector
    1.55  	printf "Moving syslinux hybrid boot record at %04X (512 bytes) ...\n" $i
    1.56  	ddq if=$2 bs=1 count=512 of=$1 seek=$i conv=notrunc
    1.57 -	if [ $(get $((0x7C00)) /tmp/exe$$) -eq 60905 ]; then
    1.58 +	if [ $(get $((0x7C00)) /tmp/exe$$) -eq 60905 ]; then	# partition boot code
    1.59  		ddq if=/tmp/exe$$ bs=1 count=66 skip=$((0x7DBE)) of=$1 seek=$(($i + 0x1BE)) conv=notrunc
    1.60  		ddq if=$1 bs=1 count=3 skip=$i of=$1 seek=$(($i + 0x1BE)) conv=notrunc
    1.61  		ddq if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i conv=notrunc
    1.62 @@ -317,7 +311,7 @@
    1.63  $(tar cf - ${@/init/rootfs.gz} | compress | uuencode -m -)
    1.64  EOT
    1.65  EOM
    1.66 -	sed -i '/^case/,/^esac/d' $0
    1.67 +	sed -i 's|[ \t]*###.*||;/^case/,/^esac/d' $0
    1.68  	exit ;;
    1.69  --get)
    1.70  	cat $2