# HG changeset patch # User Pascal Bellard # Date 1449395830 -3600 # Node ID 1e69cfd7f652b3bcd72f3f61418634b74b725dbb # Parent cc264cb074e22054c0f60fdeec16284fd7f4ed38 syslinux/taziso: get custom config diff -r cc264cb074e2 -r 1e69cfd7f652 syslinux/stuff/extra/md5sum.c --- a/syslinux/stuff/extra/md5sum.c Sat Dec 05 18:24:53 2015 +0100 +++ b/syslinux/stuff/extra/md5sum.c Sun Dec 06 10:57:10 2015 +0100 @@ -868,11 +868,11 @@ return cpu_has_level(level) && ((cpuid_edx(level) >> (x & 31) & 1)); } -static char *extfilename(char *filename, char *ext, int feature) +static const char *extfilename(const char *filename, char *ext, int feature) { #define NEWFILENAMESZ 256 static char newfilename[NEWFILENAMESZ+1]; - char *found = filename; + const char *found = filename; char *new = newfilename; int fd; @@ -892,9 +892,9 @@ return found; } -static const char *bestextfilename(char *filename) +static const char *bestextfilename(const char *filename) { - char *found; + const char *found; //found = extfilename(filename, "fpu", X86_FEATURE_FPU); //found = extfilename(filename, "686", X86_FEATURE_CMOV); diff -r cc264cb074e2 -r 1e69cfd7f652 syslinux/stuff/iso2exe/iso2exe.sh --- a/syslinux/stuff/iso2exe/iso2exe.sh Sat Dec 05 18:24:53 2015 +0100 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Sun Dec 06 10:57:10 2015 +0100 @@ -368,7 +368,7 @@ echo "#!boot $(md5sum $DATA | sed 's/ .*//')" | cat - $DATA | \ ddq bs=2k seek=$(custom_config_sector $1) of=$1 conv=notrunc if [ $(stat -c %s $1) -gt $isosz ]; then - echo "$(($isosz - $(stat -c %s $1))) extra bytes." + echo "$(($(stat -c %s $1) - $isosz)) extra bytes." else echo "$(($isosz - 32768 - 2048*$(get 32848 $1 4) - $(stat -c %s $DATA) - 24)) bytes free." diff -r cc264cb074e2 -r 1e69cfd7f652 syslinux/stuff/iso2exe/taziso --- a/syslinux/stuff/iso2exe/taziso Sat Dec 05 18:24:53 2015 +0100 +++ b/syslinux/stuff/iso2exe/taziso Sun Dec 06 10:57:10 2015 +0100 @@ -841,6 +841,22 @@ wodim -v -blank=fast } +customsector() +{ + echo $(($(get 32848 "$ISO" 4)+16)) +} + +hascustomconf() +{ + [ "$(ddq bs=2k skip=$(customsector) if="$ISO" | ddq bs=1 count=6)" \ + == "#!boot" ] +} + +gotcustomconf() +{ + hascustomconf && menuitem "$@" +} + gotisomd5() { [ "$(which md5sum 2> /dev/null)" ] && @@ -848,6 +864,25 @@ [ $(get 18 "$ISO") -ne 0 ] && menuitem "$@" } +getcustomconf() +{ + ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do + case "$line" in + \#!boot*) ;; + append=*) echo ${line#append=} > cmdline && ls -l $PWD/cmdline ;; + initrd:*) cnt=${line#initrd:} + { ddq bs=512 count=$(($cnt / 512)); + ddq bs=1 count=$(($cnt % 512)); } > initrd && + ls -l $PWD/initrd + break ;; + *) break ;; + esac + done + [ "$1" ] && return 0 + echo -e "\rPress RETURN to continue." + read n +} + isomd5() { dotwait "Checking iso image" @@ -862,16 +897,17 @@ [ $(((1+$s+$(get $(($n+1)) "$ISO" 1)) % 65536)) -eq 0 ] && echo "OK" || echo "ERROR" fi - n=$(($(get 32848 "$ISO" 4)+16)) - if [ "$(ddq bs=2k skip=$n if="$ISO" | ddq bs=1 count=6)" == "#!boot" ]; then + if hascustomconf; then echo -en "\rChecking iso custom config..." TMP=/tmp/$(basename $0)$$md5 - md5="$(ddq bs=2k skip=$n if="$ISO" | while read line; do + md5="$(ddq bs=2k skip=$(customsector) if="$ISO" | while read line; do case "$line" in \#!boot*) echo ${line#*boot } > $TMP ;; append=*) echo $line ;; initrd:*) echo $line - ddq bs=1 count=${line#initrd:} + cnt=${line#initrd:} + ddq bs=512 count=$((cnt / 512)) + ddq bs=1 count=$((cnt % 512)) break ;; *) break ;; esac @@ -1275,6 +1311,7 @@ --title " $(isotitle) " \ --menu "" -2 70 0 \ $(cdfile 'README*' "readme" "Show the README file") \ +$(gotcustomconf "getcustomconf" "Get custom config") \ $(gotisomd5 "isomd5" "Check the ISO image") \ $(cdfile 'md5sum*' "md5" "Check the ISO files") \ $(cdfile 'sha*sum*' "sha" "Check the ISO files") \