wok-next rev 18773

syslinux/iso2exe: add --force
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 31 16:02:37 2015 +0100 (2015-12-31)
parents e8de1b7505ef
children 816d2bd9090b
files syslinux/stuff/iso2exe/iso2exe.sh
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Thu Dec 31 15:53:34 2015 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Thu Dec 31 16:02:37 2015 +0100
     1.3 @@ -130,6 +130,14 @@
     1.4  	echo $(($(get 32848 "$1" 4)+16))
     1.5  }
     1.6  
     1.7 +clear_custom_config()
     1.8 +{
     1.9 +    start=$(custom_config_sector $1)
    1.10 +    cnt=$((512 - ($start % 512)))
    1.11 +    [ $cnt -ne 512 ] &&
    1.12 +    ddq if=/dev/zero of=$1 bs=2k seek=$start count=$cnt
    1.13 +}
    1.14 +
    1.15  extract_custom_config()
    1.16  {
    1.17  	ISO="$1"
    1.18 @@ -300,7 +308,7 @@
    1.19  	done
    1.20  	
    1.21  	[ ! -s "$1" ] && cat 1>&2 <<EOT && exit 1
    1.22 -usage: $0 [--append custom_cmdline ] [ --initrd custom_initramfs ] image.iso [--undo|"DOS help message"]
    1.23 +usage: $0 [--append custom_cmdline ] [ --initrd custom_initramfs ] image.iso [--force|--undo|"DOS help message"]
    1.24  or: $0 --extract-custom-config image.iso
    1.25  EOT
    1.26  	case "${2/--/-}" in
    1.27 @@ -315,11 +323,11 @@
    1.28  		ddq if=/dev/zero bs=1 seek=$n count=$((0x8000 - $n)) of=$1 conv=notrunc ;;
    1.29  	    *)  ddq if=/dev/zero bs=1k count=32 of=$1 conv=notrunc ;;
    1.30  	    esac
    1.31 -	    start=$(custom_config_sector $1)
    1.32 -	    cnt=$((512 - ($start % 512)))
    1.33 -	    [ $cnt -ne 512 ] &&
    1.34 -	    ddq if=/dev/zero of=$1 bs=2k seek=$start count=$cnt
    1.35 +	    clear_custom_config
    1.36  	    exit 0
    1.37 +	-f*)
    1.38 +	    ddq if=/dev/zero bs=1k count=32 of=$1 conv=notrunc
    1.39 +	    [ "$append$initrd" ] && clear_custom_config
    1.40  	esac
    1.41  	case "$(get 0 $1)" in
    1.42  	23117)	echo "The file $1 is already an EXE file." 1>&2 && exit 1;;