wok diff syslinux/stuff/iso2exe/iso2exe.sh @ rev 17591

syslinux/isohybrib.exe: add --md5, --undo
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 10 08:53:27 2015 +0100 (2015-02-10)
parents 00bb1e4137c6
children 639e963885dd
line diff
     1.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Sat Feb 07 15:39:46 2015 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Tue Feb 10 08:53:27 2015 +0100
     1.3 @@ -140,8 +140,49 @@
     1.4  
     1.5  #ifdef WIN32
     1.6  static char $name[] = {
     1.7 +/* head */
     1.8  $(hexdump -v -n $HSZ -e '"    " 16/1 "0x%02X, "' -e '"  // %04.4_ax |" 16/1 "%_p" "| \n"' $DATA | sed 's/ 0x  ,/      /g')
     1.9 +/* tail */
    1.10  $(hexdump -v -s $OFS -e '"    " 16/1 "0x%02X, "' -e '"  // %04.4_ax |" 16/1 "%_p" "| \n"' $DATA | sed 's/ 0x  ,/      /g')
    1.11 +
    1.12 +/* These strange constants are defined in RFC 1321 as
    1.13 +   T[i] = (int)(4294967296.0 * fabs(sin(i))), i=1..64
    1.14 + */
    1.15 +/* static const uint32_t C_array[64] */
    1.16 +EOT
    1.17 +	while read a b c d; do
    1.18 +		for i in $a $b $c $d; do
    1.19 +			echo $i | sed 's/0x\(..\)\(..\)\(..\)\(..\),/0x\4, 0x\3, 0x\2, 0x\1, /'
    1.20 +		done
    1.21 +	done <<EOT
    1.22 +	0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
    1.23 +	0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
    1.24 +	0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
    1.25 +	0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
    1.26 +	0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
    1.27 +	0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
    1.28 +	0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
    1.29 +	0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
    1.30 +	0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
    1.31 +	0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
    1.32 +	0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
    1.33 +	0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
    1.34 +	0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
    1.35 +	0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
    1.36 +	0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
    1.37 +	0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
    1.38 +EOT
    1.39 +	cat <<EOT
    1.40 +/* static const char P_array[64] */
    1.41 +	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 1 */
    1.42 +	1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, /* 2 */
    1.43 +	5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, /* 3 */
    1.44 +	0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9, /* 4 */
    1.45 +/* static const char S_array[16] */
    1.46 +	7, 12, 17, 22,
    1.47 +	5, 9, 14, 20,
    1.48 +	4, 11, 16, 23,
    1.49 +	6, 10, 15, 21,
    1.50  EOT
    1.51  
    1.52  for mode in data offset ; do
    1.53 @@ -158,21 +199,27 @@
    1.54  #else
    1.55  static char *$name;
    1.56  #endif
    1.57 +
    1.58 +#define C_array (uint32_t *) ($name + $(($BOOTISOSZ)))
    1.59 +#define P_array (char *)     ($name + $(($BOOTISOSZ+(64*4))))
    1.60 +#define S_array (char *)     ($name + $(($BOOTISOSZ+(64*4)+64)))
    1.61  #define ELTORITOOFS	3
    1.62  EOT
    1.63  			fi
    1.64 -			echo "#define $tag	$(($BOOTISOSZ+$ofs))"
    1.65 +			echo "#define $tag	$(($BOOTISOSZ+(64*4)+64+16+$ofs))"
    1.66  			ofs=$(($(echo -en "$str\0" | wc -c)+$ofs))
    1.67  		fi
    1.68  	done <<EOT
    1.69  READSECTORERR	Read sector failure.
    1.70 -USAGE		Usage: isohybrid.exe file.iso [--forced]
    1.71 +USAGE		Usage: isohybrid.exe file.iso [--forced|--undo|--md5]
    1.72  OPENERR		Can't open r/w the iso file.
    1.73  ELTORITOERR	No EL TORITO SPECIFICATION signature.
    1.74  CATALOGERR	Invalid boot catalog.
    1.75  HYBRIDERR	No isolinux.bin hybrid signature.
    1.76  SUCCESSMSG	Now you can create a USB key with your .iso file.\\\\nSimply rename it to a .exe file and run it.
    1.77  FORCEMSG	You can add --forced to proceed anyway.
    1.78 +MD5MSG		Computing md5sum...
    1.79 +UNINSTALLMSG	Uninstall done.
    1.80  EOT
    1.81  done
    1.82  	rm -rf $DATA
    1.83 @@ -242,7 +289,7 @@
    1.84  		ddq bs=1 seek=$((0x7FDE)) count=15 conv=notrunc of=$1
    1.85  	if [ $(stat -c %s $1) -gt 34816 ]; then
    1.86  		echo "Adding ISO image md5 at 7FF0 (16 bytes) ..."
    1.87 -		echo -en "$(ddq if=$1 bs=2k skip=16 count=$(get 32848 $1) | \
    1.88 +		echo -en "$(ddq if=$1 bs=2k skip=16 count=$(get 32848 $1 4) | \
    1.89  			md5sum | cut -c-32 | sed 's/\(..\)/\\x\1/g')" | \
    1.90  			ddq bs=16 seek=2047 conv=notrunc of=$1
    1.91  	fi