wok rev 18672

syslinux/iso2exe: undo custom config too
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Dec 05 12:23:18 2015 +0100 (2015-12-05)
parents 28bf6d31c5b9
children 86d61e110274
files syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/taziso
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Fri Dec 04 22:20:10 2015 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Sat Dec 05 12:23:18 2015 +0100
     1.3 @@ -315,6 +315,10 @@
     1.4  		ddq if=/dev/zero bs=1 seek=$n count=$((0x8000 - $n)) of=$1 conv=notrunc ;;
     1.5  	    *)  ddq if=/dev/zero bs=1k count=32 of=$1 conv=notrunc ;;
     1.6  	    esac
     1.7 +	    start=$(custom_config_sector $1)
     1.8 +	    cnt=$((512 - ($start % 512)))
     1.9 +	    [ $cnt -ne 512 ] &&
    1.10 +	    ddq if=/dev/zero of=$1 bs=2k seek=$start count=$cnt
    1.11  	    exit 0
    1.12  	esac
    1.13  	case "$(get 0 $1)" in
    1.14 @@ -357,20 +361,20 @@
    1.15  		echo -n "Adding custom config... "
    1.16  		DATA=/tmp/$0$$
    1.17  		rm -f $DATA > /dev/null
    1.18 -		isosz=$(stat -c %s $ISO)
    1.19 +		isosz=$(stat -c %s $1)
    1.20  		[ "$append" ] && echo "append=$append" >> $DATA
    1.21  		[ -s "$initrd" ] && echo "initrd:$(stat -c %s $initrd)" >> $DATA &&
    1.22  			cat $initrd >> $DATA
    1.23  		echo "#!boot $(md5sum $DATA | sed 's/ .*//')" | cat - $DATA | \
    1.24 -		ddq bs=2k seek=$(custom_config_sector $ISO) of=$ISO conv=notrunc
    1.25 -		if [ $(stat -c %s $ISO) -gt $isosz ]; then
    1.26 -			echo "$(($isosz - $(stat -c %s $ISO))) extra bytes."
    1.27 +		ddq bs=2k seek=$(custom_config_sector $1) of=$1 conv=notrunc
    1.28 +		if [ $(stat -c %s $1) -gt $isosz ]; then
    1.29 +			echo "$(($isosz - $(stat -c %s $1))) extra bytes."
    1.30  		else
    1.31 -			echo "$(($isosz - 32768 - 2048*$(get 32848 $ISO 4) 
    1.32 +			echo "$(($isosz - 32768 - 2048*$(get 32848 $1 4) 
    1.33  				 - $(stat -c %s $DATA) - 24)) bytes free."
    1.34  		fi
    1.35  		rm -f $DATA > /dev/null
    1.36  	fi
    1.37  }
    1.38  
    1.39 -main $@ <<EOT
    1.40 +main "$@" <<EOT
     2.1 --- a/syslinux/stuff/iso2exe/taziso	Fri Dec 04 22:20:10 2015 +0100
     2.2 +++ b/syslinux/stuff/iso2exe/taziso	Sat Dec 05 12:23:18 2015 +0100
     2.3 @@ -864,10 +864,11 @@
     2.4  	fi
     2.5  	n=$(($(get 32848 "$ISO" 4)+16))
     2.6  	if [ "$(ddq bs=2k skip=$n if="$ISO" | ddq bs=1 count=6)" == "#!boot" ]; then
     2.7 -		echo -en "\rChecking iso custum boot..."
     2.8 +		echo -en "\rChecking iso custom config..."
     2.9 +		TMP=/tmp/$(basename $0)$$md5
    2.10  		md5="$(ddq bs=2k skip=$n if="$ISO" | while read line; do
    2.11  			case "$line" in
    2.12 -			\#!boot*) echo ${line#*boot } > /tmp/$0$$md5 ;;
    2.13 +			\#!boot*) echo ${line#*boot } > $TMP ;;
    2.14  			append=*) echo $line ;;
    2.15  			initrd:*) echo $line
    2.16  				  ddq bs=1 count=${line#initrd:}
    2.17 @@ -875,8 +876,8 @@
    2.18  			*)	  break ;;	  
    2.19  			esac
    2.20  		done | md5sum | cut -c1-32)"
    2.21 -		[ "$md5" == "$(cat /tmp/$0$$md5)" ] && echo "OK" || echo "ERROR"
    2.22 -		rm -f /tmp/$0$$md5
    2.23 +		[ "$md5" == "$(cat $TMP)" ] && echo "OK" || echo "ERROR"
    2.24 +		rm -f $TMP
    2.25  	fi
    2.26  	rm -f /tmp/wait
    2.27  	[ "$1" ] && return 0