wok-next 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 cc264cb074e2
children 3fa45a5a20c6
files syslinux/stuff/extra/md5sum.c syslinux/stuff/iso2exe/iso2exe.sh syslinux/stuff/iso2exe/taziso
line diff
     1.1 --- a/syslinux/stuff/extra/md5sum.c	Sat Dec 05 18:24:53 2015 +0100
     1.2 +++ b/syslinux/stuff/extra/md5sum.c	Sun Dec 06 10:57:10 2015 +0100
     1.3 @@ -868,11 +868,11 @@
     1.4      return cpu_has_level(level) && ((cpuid_edx(level) >> (x & 31) & 1));
     1.5  }
     1.6  
     1.7 -static char *extfilename(char *filename, char *ext, int feature)
     1.8 +static const char *extfilename(const char *filename, char *ext, int feature)
     1.9  {
    1.10  #define NEWFILENAMESZ 256
    1.11  	static char newfilename[NEWFILENAMESZ+1];
    1.12 -	char *found = filename;
    1.13 +	const char *found = filename;
    1.14  	char *new = newfilename;
    1.15  	int fd;
    1.16  
    1.17 @@ -892,9 +892,9 @@
    1.18  	return found;
    1.19  }
    1.20  
    1.21 -static const char *bestextfilename(char *filename)
    1.22 +static const char *bestextfilename(const char *filename)
    1.23  {
    1.24 -	char *found;
    1.25 +	const char *found;
    1.26  
    1.27  	//found = extfilename(filename, "fpu",   X86_FEATURE_FPU);
    1.28  	//found = extfilename(filename, "686",   X86_FEATURE_CMOV);
     2.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Sat Dec 05 18:24:53 2015 +0100
     2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Sun Dec 06 10:57:10 2015 +0100
     2.3 @@ -368,7 +368,7 @@
     2.4  		echo "#!boot $(md5sum $DATA | sed 's/ .*//')" | cat - $DATA | \
     2.5  		ddq bs=2k seek=$(custom_config_sector $1) of=$1 conv=notrunc
     2.6  		if [ $(stat -c %s $1) -gt $isosz ]; then
     2.7 -			echo "$(($isosz - $(stat -c %s $1))) extra bytes."
     2.8 +			echo "$(($(stat -c %s $1) - $isosz)) extra bytes."
     2.9  		else
    2.10  			echo "$(($isosz - 32768 - 2048*$(get 32848 $1 4) 
    2.11  				 - $(stat -c %s $DATA) - 24)) bytes free."
     3.1 --- a/syslinux/stuff/iso2exe/taziso	Sat Dec 05 18:24:53 2015 +0100
     3.2 +++ b/syslinux/stuff/iso2exe/taziso	Sun Dec 06 10:57:10 2015 +0100
     3.3 @@ -841,6 +841,22 @@
     3.4  	wodim -v -blank=fast
     3.5  }
     3.6  
     3.7 +customsector()
     3.8 +{
     3.9 +	echo $(($(get 32848 "$ISO" 4)+16))
    3.10 +}
    3.11 +
    3.12 +hascustomconf()
    3.13 +{
    3.14 +	[ "$(ddq bs=2k skip=$(customsector) if="$ISO" | ddq bs=1 count=6)" \
    3.15 +	  == "#!boot" ]
    3.16 +}
    3.17 +
    3.18 +gotcustomconf()
    3.19 +{
    3.20 +	hascustomconf && menuitem "$@"
    3.21 +}
    3.22 +
    3.23  gotisomd5()
    3.24  {
    3.25  	[ "$(which md5sum 2> /dev/null)" ] &&
    3.26 @@ -848,6 +864,25 @@
    3.27  	[ $(get 18 "$ISO") -ne 0 ] && menuitem "$@"
    3.28  }
    3.29  
    3.30 +getcustomconf()
    3.31 +{
    3.32 +	ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
    3.33 +		case "$line" in
    3.34 +		\#!boot*) ;;
    3.35 +		append=*) echo ${line#append=} > cmdline && ls -l $PWD/cmdline ;;
    3.36 +		initrd:*) cnt=${line#initrd:}
    3.37 +			  { ddq bs=512 count=$(($cnt / 512));
    3.38 +			    ddq bs=1 count=$(($cnt % 512)); } > initrd &&
    3.39 +			  ls -l $PWD/initrd
    3.40 +			  break ;;
    3.41 +		*)	  break ;;	  
    3.42 +		esac
    3.43 +	done
    3.44 +	[ "$1" ] && return 0
    3.45 +	echo -e "\rPress RETURN to continue."
    3.46 +	read n
    3.47 +}
    3.48 +
    3.49  isomd5()
    3.50  {
    3.51  	dotwait "Checking iso image"
    3.52 @@ -862,16 +897,17 @@
    3.53  		[ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] &&
    3.54  		echo "OK" || echo "ERROR"
    3.55  	fi
    3.56 -	n=$(($(get 32848 "$ISO" 4)+16))
    3.57 -	if [ "$(ddq bs=2k skip=$n if="$ISO" | ddq bs=1 count=6)" == "#!boot" ]; then
    3.58 +	if hascustomconf; then
    3.59  		echo -en "\rChecking iso custom config..."
    3.60  		TMP=/tmp/$(basename $0)$$md5
    3.61 -		md5="$(ddq bs=2k skip=$n if="$ISO" | while read line; do
    3.62 +		md5="$(ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do
    3.63  			case "$line" in
    3.64  			\#!boot*) echo ${line#*boot } > $TMP ;;
    3.65  			append=*) echo $line ;;
    3.66  			initrd:*) echo $line
    3.67 -				  ddq bs=1 count=${line#initrd:}
    3.68 +				  cnt=${line#initrd:}
    3.69 +				  ddq bs=512 count=$((cnt / 512))
    3.70 +				  ddq bs=1 count=$((cnt % 512))
    3.71  				  break ;;
    3.72  			*)	  break ;;	  
    3.73  			esac
    3.74 @@ -1275,6 +1311,7 @@
    3.75  	--title " $(isotitle) " \
    3.76  	--menu "" -2 70 0 \
    3.77  $(cdfile 'README*'	"readme"	"Show the README file") \
    3.78 +$(gotcustomconf		"getcustomconf"	"Get custom config") \
    3.79  $(gotisomd5		"isomd5"	"Check the ISO image") \
    3.80  $(cdfile 'md5sum*'	"md5"		"Check the ISO files") \
    3.81  $(cdfile 'sha*sum*'	"sha"		"Check the ISO files") \