Commit 913fe4e1 authored by Diego Elio Pettenò's avatar Diego Elio Pettenò
Browse files

Allow passing the device/file on the script command line.

Also fix EXFAT handling so that it actually works on exfat volumes.

--HG--
branch : unified
parent efecf5112baa
......@@ -18,6 +18,7 @@ if [[ $OSTYPE == darwin* ]]; then # OS X
elif [[ $OSTYPE == linux* ]]; then # Linux
UNMOUNT='umount'
fi
if [[ -z $1 ]]; then
dev=$(mount | grep EOS_DIGITAL | awk '{print $1}' )
if [ "x$dev" = "x" ]; then
echo "The EOS_DIGITAL card should be mounted before running the script."
......@@ -29,9 +30,12 @@ fi
exit
fi
$UNMOUNT $dev
else
dev=$1
fi
# read the boot sector to determine the filesystem version
DEV64=`dd if=$dev bs=1 skip=3 count=8 2>/dev/null`
EXFAT=`dd if=$dev bs=1 skip=3 count=8 2>/dev/null`
DEV32=`dd if=$dev bs=1 skip=82 count=8 2>/dev/null`
DEV16=`dd if=$dev bs=1 skip=54 count=8 2>/dev/null`
if [ "$DEV16" != 'FAT16 ' -a "$DEV32" != 'FAT32 ' -a "$EXFAT" != 'EXFAT ' ]; then
......@@ -48,7 +52,7 @@ elif [ "$DEV32" = 'FAT32 ' ]; then
offset1=71
offset2=92
FS='FAT32'
elif [ "$DEV64" = 'EXFAT ' ]; then
elif [ "$EXFAT" = 'EXFAT ' ]; then
offset1=130
offset2=122
FS='EXFAT'
......@@ -75,4 +79,4 @@ dd of="$dev" if="$dump_file" bs=1 seek=5632 skip=5632 count=512 2>/dev/null
dd of="$dev" if="$dump_file" bs=1 seek=11776 skip=5632 count=512 2>/dev/null
#dd if=$dev of=verif_dump.bin bs=1 skip=0 count=12288 2>/dev/null
rm -f "$dump_file"
fi
\ No newline at end of file
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment