diff options
author | Daniel Baumann <daniel@debian.org> | 2007-09-23 10:04:46 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 18:14:51 +0100 |
commit | fe6eb1c593e2df135c8807bf94df614984b4d6ec (patch) | |
tree | 693b803dcc6473a8699f0c605c92b10c24755e28 /helpers/lh_losetup | |
parent | 470cf1764bf56b32addff591cfe3fd69af0e5760 (diff) | |
download | vyos-live-build-fe6eb1c593e2df135c8807bf94df614984b4d6ec.tar.gz vyos-live-build-fe6eb1c593e2df135c8807bf94df614984b4d6ec.zip |
Adding live-helper 1.0~a1-1.
Diffstat (limited to 'helpers/lh_losetup')
-rwxr-xr-x | helpers/lh_losetup | 10 |
1 files changed, 8 insertions, 2 deletions
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> <file> <partition> -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))" |