wok view syslinux/stuff/iso2exe/chkmd5.sh @ rev 20891

Update some WEB_SITE
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 08:20:18 2019 +0100 (11 months ago)
parents
children
line source
1 #!/bin/sh
3 ddq()
4 {
5 dd $@ 2> /dev/null
6 }
8 get()
9 {
10 od -v -j $1 -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} -An $2 2>/dev/null ||
11 hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %d\n\"" $2
12 }
14 [ -z "$1" ] && echo "usage: $0 file.iso" && exit 1
16 echo "iso data sectors 16..$(echo $(get 32848 $1 4))"
17 ddq if=$1 bs=2k skip=16 count=$(echo $(get 32848 $1 4)) | md5sum
18 ddq if=$1 bs=16 count=1 skip=2047 | od -N 16 -t x1 -An | sed 's/ //g'
19 n=$(($(get 2 $1)-1+($(get 4 $1)-1)*512))
20 [ 0 -ne $(get 18 $1) ] && [ $n -lt 50000 ] && [ $n -gt 32768 ] &&
21 printf "exe16 chk 0..%04X (65535) %d\n" $n $(get 0 $1 2 $n | awk '{ i+= $0 } END { print i % 65536 }')
22 echo -n "boot chk 40..8000 (0) "
23 get 64 $1 2 32704 | awk '{ i+= $0 } END { print i % 65536 }'
24 if [ 23117 -eq $(get 0 $1) ]; then
25 win32sz=$((512*$(get 69 $1 1)))
26 [ 17744 -eq $(get 128 $1) ] && printf "WIN32 file at 0000 (%d bytes)\n" $win32sz
27 [ 29538 -eq $(get 125 $1) ] && echo "bootiso head at 0000"
28 if [ $win32sz -ne 0 ]; then
29 printf "syslinux hybrid boot record at %04X (512 bytes)\n" $win32sz
30 printf "tazlito data record at %04X (512 bytes)\n" $(($win32sz+512))
31 fi
32 dosexe=$(($(get 20 $1) - 0xC0))
33 rootfs=$(($dosexe - $(get 24 $1)))
34 doscom=$(get 66 $1)
35 fdsect=$(get 28 $1 1)
36 printf "%d free bytes at %04X..%04X\n" $(($doscom - (512*$fdsect) - $win32sz - 1024)) $(($win32sz+1024)) $(($doscom - (512*$fdsect)))
37 [ $fdsect -ne 0 ] &&
38 printf "floppy bootstrap file at %04X (%d bytes)\n" $(($doscom - (512*$fdsect))) $((512*$fdsect))
39 [ $doscom -ne 0 ] &&
40 printf "DOS boot file at %04X (%d bytes)\n" $doscom $(($rootfs - $doscom))
41 [ $dosexe -ne $rootfs ] &&
42 printf "rootfs.gz file at %04X (%d bytes)\n" $rootfs $(($dosexe - $rootfs))
43 printf "DOS/EXE stub at %04X (%d bytes)\n" $dosexe $((0x8000 - $dosexe))
44 [ 0 -ne $(get 32756 $1) ] && echo "ISO image md5 at 7FF0 (16 bytes)"
45 fi