From fe6eb1c593e2df135c8807bf94df614984b4d6ec Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 23 Sep 2007 10:04:46 +0200 Subject: Adding live-helper 1.0~a1-1. --- helpers/lh_losetup | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'helpers/lh_losetup') diff --git a/helpers/lh_losetup b/helpers/lh_losetup index e2b3c0d10..442afdb87 100755 --- a/helpers/lh_losetup +++ b/helpers/lh_losetup @@ -2,7 +2,13 @@ # lh_losetup -DEVICE="${1}" +if [ -z "${1}" ] +then + DEVICE="`losetup -f`" +else + DEVICE="${1}" +fi + FILE="${2}" PARTITION="${3}" @@ -11,7 +17,7 @@ FDISK_OUT="`fdisk -l -u ${DEVICE} 2>&1`" losetup -d "${DEVICE}" LOOPDEVICE="`echo ${DEVICE}p${PARTITION:=1}`" -CYL="`echo ${FDISK_OUT} | sed -ne "s_^${LOOPDEVICE}[ *]*\([0-9]*\).*_\1_p" `" +CYL=`echo "$FDISK_OUT" | sed -ne "s_^$LOOPDEVICE[ *]*\([0-9]*\).*_\1_p"` #OFFSET="`expr 512 '*' ${CYL}`" OFFSET="$((CYL*512))" -- cgit v1.2.3