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

syslinux/iso2exe: fix checksum
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Feb 06 12:05:22 2013 +0100 (2013-02-06)
parents b5ea41033c21
children a26ba54f3ea7
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Tue Feb 05 23:32:17 2013 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Wed Feb 06 12:05:22 2013 +0100
     1.3 @@ -44,8 +44,6 @@
     1.4  	*5a4d)	echo "The file $1 is already an EXE file." 1>&2 && exit 1;;
     1.5  	*0000)	[ -x /usr/bin/isohybrid ] && isohybrid $1
     1.6  	esac
     1.7 -	[ ! -x /usr/sbin/mount.posixovl ] && 
     1.8 -	echo "No file mount.posixovl. Aborting." 1>&2 && exit 1
     1.9  		
    1.10  	echo "Moving syslinux hybrid boot record..."
    1.11  	ddq if=$1 bs=512 count=1 | ddq of=$1 bs=512 count=1 seek=1 conv=notrunc 
    1.12 @@ -56,10 +54,11 @@
    1.13  	# keep the largest room for the tazlito info file
    1.14  	TMP=/tmp/iso2exe$$
    1.15  	mkdir -p $TMP/bin $TMP/dev
    1.16 -	cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe
    1.17  	cp -a /dev/?d?* $TMP/dev
    1.18  	$0 --get init > $TMP/init.exe
    1.19 -	chmod +x $TMP/init.exe $TMP/bin/mount.posixov*
    1.20 +	grep -q mount.posixovl.iso2exe $TMP/init.exe &&
    1.21 +	cp /usr/sbin/mount.posixovl $TMP/bin/mount.posixovl.iso2exe
    1.22 +	find $TMP -type f | xargs chmod +x
    1.23  	( cd $TMP ; find * | cpio -o -H newc ) | \
    1.24  		lzma e $TMP/rootfs.gz -si 2> /dev/null
    1.25  	SIZE=$(wc -c < $TMP/rootfs.gz)
    1.26 @@ -73,19 +72,21 @@
    1.27  	printf "Adding DOS boot file at %04X...\n" $OFS
    1.28  	$0 --get boot.com | ddq of=$1 bs=1 seek=$OFS conv=notrunc
    1.29  	store 66 $(($OFS+0xC0)) $1
    1.30 -	SIZE=$($0 --get win32.exe | tee /tmp/exe$$ | wc -c)
    1.31 -	OFS=$(( 128 + ( ($OFS - $SIZE + 128) & 0xFE00 ) ))
    1.32 -	printf "Adding WIN32 file at %04X...\n" $OFS
    1.33 -	LOC=$((0xAC+$(get 0x94 /tmp/exe$$)))
    1.34 -	for i in $(seq 1 $(get 0x86 /tmp/exe$$)); do
    1.35 -		store $LOC $(($(get $LOC /tmp/exe$$)+$OFS-128)) /tmp/exe$$
    1.36 -		LOC=$(($LOC+40))
    1.37 -	done
    1.38 -	ddq if=/tmp/exe$$ of=$1 bs=1 skip=128 seek=$OFS conv=notrunc
    1.39 +	SIZE=$($0 --get win32.exe 2> /dev/null | tee /tmp/exe$$ | wc -c)
    1.40 +	if [ $SIZE -ne 0 ]; then
    1.41 +		OFS=$(( 128 + ( ($OFS - $SIZE + 128) & 0xFE00 ) ))
    1.42 +		printf "Adding WIN32 file at %04X...\n" $OFS
    1.43 +		LOC=$((0xAC+$(get 0x94 /tmp/exe$$)))
    1.44 +		for i in $(seq 1 $(get 0x86 /tmp/exe$$)); do
    1.45 +			store $LOC $(($(get $LOC /tmp/exe$$)+$OFS-128)) /tmp/exe$$
    1.46 +			LOC=$(($LOC+40))
    1.47 +		done
    1.48 +		ddq if=/tmp/exe$$ of=$1 bs=1 skip=128 seek=$OFS conv=notrunc
    1.49 +	fi
    1.50  	rm -f /tmp/exe$$ 
    1.51  	store 60 $OFS $1
    1.52  	store 26 ${RANDOM:-0} $1
    1.53 -	i=34
    1.54 +	i=66
    1.55  	n=0
    1.56  	echo -n "Adding checksum..."
    1.57  	while [ $i -lt 32768 ]; do