wok-next diff syslinux/stuff/iso2exe/taziso @ rev 18675

syslinux/taziso: get custom config
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 06 10:57:10 2015 +0100 (2015-12-06)
parents 857cceeac404
children a7572fba48de
line diff
     1.1 --- a/syslinux/stuff/iso2exe/taziso	Sat Dec 05 12:23:18 2015 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/taziso	Sun Dec 06 10:57:10 2015 +0100
     1.3 @@ -841,6 +841,22 @@
     1.4  	wodim -v -blank=fast
     1.5  }
     1.6  
     1.7 +customsector()
     1.8 +{
     1.9 +	echo $(($(get 32848 "$ISO" 4)+16))
    1.10 +}
    1.11 +
    1.12 +hascustomconf()
    1.13 +{
    1.14 +	[ "$(ddq bs=2k skip=$(customsector) if="$ISO" | ddq bs=1 count=6)" \
    1.15 +	  == "#!boot" ]
    1.16 +}
    1.17 +
    1.18 +gotcustomconf()
    1.19 +{
    1.20 +	hascustomconf && menuitem "$@"
    1.21 +}
    1.22 +
    1.23  gotisomd5()
    1.24  {
    1.25  	[ "$(which md5sum 2> /dev/null)" ] &&
    1.26 @@ -848,6 +864,25 @@
    1.27  	[ $(get 18 "$ISO") -ne 0 ] && menuitem "$@"
    1.28  }
    1.29  
    1.30 +getcustomconf()
    1.31 +{
    1.32 +	ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
    1.33 +		case "$line" in
    1.34 +		\#!boot*) ;;
    1.35 +		append=*) echo ${line#append=} > cmdline && ls -l $PWD/cmdline ;;
    1.36 +		initrd:*) cnt=${line#initrd:}
    1.37 +			  { ddq bs=512 count=$(($cnt / 512));
    1.38 +			    ddq bs=1 count=$(($cnt % 512)); } > initrd &&
    1.39 +			  ls -l $PWD/initrd
    1.40 +			  break ;;
    1.41 +		*)	  break ;;	  
    1.42 +		esac
    1.43 +	done
    1.44 +	[ "$1" ] && return 0
    1.45 +	echo -e "\rPress RETURN to continue."
    1.46 +	read n
    1.47 +}
    1.48 +
    1.49  isomd5()
    1.50  {
    1.51  	dotwait "Checking iso image"
    1.52 @@ -862,16 +897,17 @@
    1.53  		[ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] &&
    1.54  		echo "OK" || echo "ERROR"
    1.55  	fi
    1.56 -	n=$(($(get 32848 "$ISO" 4)+16))
    1.57 -	if [ "$(ddq bs=2k skip=$n if="$ISO" | ddq bs=1 count=6)" == "#!boot" ]; then
    1.58 +	if hascustomconf; then
    1.59  		echo -en "\rChecking iso custom config..."
    1.60  		TMP=/tmp/$(basename $0)$$md5
    1.61 -		md5="$(ddq bs=2k skip=$n if="$ISO" | while read line; do
    1.62 +		md5="$(ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
    1.63  			case "$line" in
    1.64  			\#!boot*) echo ${line#*boot } > $TMP ;;
    1.65  			append=*) echo $line ;;
    1.66  			initrd:*) echo $line
    1.67 -				  ddq bs=1 count=${line#initrd:}
    1.68 +				  cnt=${line#initrd:}
    1.69 +				  ddq bs=512 count=$((cnt / 512))
    1.70 +				  ddq bs=1 count=$((cnt % 512))
    1.71  				  break ;;
    1.72  			*)	  break ;;	  
    1.73  			esac
    1.74 @@ -1275,6 +1311,7 @@
    1.75  	--title " $(isotitle) " \
    1.76  	--menu "" -2 70 0 \
    1.77  $(cdfile 'README*'	"readme"	"Show the README file") \
    1.78 +$(gotcustomconf		"getcustomconf"	"Get custom config") \
    1.79  $(gotisomd5		"isomd5"	"Check the ISO image") \
    1.80  $(cdfile 'md5sum*'	"md5"		"Check the ISO files") \
    1.81  $(cdfile 'sha*sum*'	"sha"		"Check the ISO files") \