#!/bin/sh
#  Usage:  disk.mount <image_filename> [mount_point [partition_#] 
FILE=$1 ; MNT=$2 ; PART=$3
UNITS=`fdisk -l "$FILE" 2>&1 | sed -ne 's#^[0-9]* heads, \([0-9]*\) sectors.*$#\1#p'`
CYL=`fdisk -l "$FILE" 2>&1 | sed -ne "s#^$FILE${PART:=1}[ *]*\([0-9]*\).*#\1#p"`
START=$((UNITS*CYL*512))
mount "$FILE" "${MNT:=/mnt/image}" -oloop,offset=$START
