wok diff syslinux/stuff/iso2exe/init @ rev 17492

syslinux/iso2exe: check ISO md5
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jan 03 21:41:48 2015 +0100 (2015-01-03)
parents 2c2a6dd5ba40
children 26654c1a7ca7
line diff
     1.1 --- a/syslinux/stuff/iso2exe/init	Fri Jan 02 21:46:16 2015 +0100
     1.2 +++ b/syslinux/stuff/iso2exe/init	Sat Jan 03 21:41:48 2015 +0100
     1.3 @@ -1,6 +1,7 @@
     1.4  #!/bin/sh
     1.5  
     1.6  DIALOG=dialog
     1.7 +ISOMD5=
     1.8  
     1.9  ddq()
    1.10  {
    1.11 @@ -118,7 +119,7 @@
    1.12  {
    1.13  	echo "Creating $(basename $1) ..."
    1.14  	O=$(($(get 66 /mnt/$ISO) - 0xC0))
    1.15 -	L=$((0x7EE0 - $(get 24 /mnt/$ISO) - $O))
    1.16 +	L=$(($(get 20 /mnt/$ISO) - 0xC0 - $(get 24 /mnt/$ISO) - $O))
    1.17  	S=$((32+$L))
    1.18  	P=$((($S+511)/512))
    1.19  	E=$((4096-(32*$P)))
    1.20 @@ -635,6 +636,21 @@
    1.21  	echo -en "\"$1\"	\"$2\""
    1.22  }
    1.23  
    1.24 +gotisomd5()
    1.25 +{
    1.26 +	[ "$(which md5sum 2> /dev/null)" ] && [ "$ISOMD5" ] &&
    1.27 +	echo -en "\"$1\"	\"$2\""
    1.28 +}
    1.29 +
    1.30 +isomd5()
    1.31 +{
    1.32 +	dotwait "Checking iso image"
    1.33 +	[ "$(ddq if=/dev/loop0 bs=32k skip=1 | md5sum)" == "$ISOMD5  -" ] &&
    1.34 +	echo "OK" || echo "ERROR"
    1.35 +	rm -f /tmp/wait
    1.36 +	sleep 5
    1.37 +}
    1.38 +
    1.39  fdbootstrap()
    1.40  {
    1.41  	sz=$((512 * $(echo $(get 28 /mnt/$ISO 1))))
    1.42 @@ -886,8 +902,9 @@
    1.43  $(cdfile boot/bzImage	"live"		"Linux RAM boot (full desktop)") \
    1.44  			"text"		"Linux RAM boot" \
    1.45  $(cdfile README*	"readme"	"Show the README file") \
    1.46 -$(cdfile md5sum*	"md5"		"Check ISO files") \
    1.47 -$(cdfile sha*sum*	"sha"		"Check ISO files") \
    1.48 +$(gotisomd5		"isomd5"	"Check the ISO image") \
    1.49 +$(cdfile md5sum*	"md5"		"Check the ISO files") \
    1.50 +$(cdfile sha*sum*	"sha"		"Check the ISO files") \
    1.51  $(gotposixovl		"install"	"Hard disk installation (UMSDOS way)") \
    1.52  $(gotposixovl		"installtaz"	"Hard disk installation (TAZUSB way)") \
    1.53  $(xfile tazusb		"usbkey"	"USB key read/write installation") \