summaryrefslogtreecommitdiff
path: root/helpers/lh_losetup
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/lh_losetup')
-rwxr-xr-xhelpers/lh_losetup22
1 files changed, 17 insertions, 5 deletions
diff --git a/helpers/lh_losetup b/helpers/lh_losetup
index 442afdb..94337ac 100755
--- a/helpers/lh_losetup
+++ b/helpers/lh_losetup
@@ -2,9 +2,21 @@
# lh_losetup <device> <file> <partition>
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Set_defaults
+
if [ -z "${1}" ]
then
- DEVICE="`losetup -f`"
+ DEVICE="`${LH_LOSETUP} -f`"
else
DEVICE="${1}"
fi
@@ -12,9 +24,9 @@ fi
FILE="${2}"
PARTITION="${3}"
-losetup "${DEVICE}" "${FILE}"
+${LH_LOSETUP} "${DEVICE}" "${FILE}"
FDISK_OUT="`fdisk -l -u ${DEVICE} 2>&1`"
-losetup -d "${DEVICE}"
+${LH_LOSETUP} -d "${DEVICE}"
LOOPDEVICE="`echo ${DEVICE}p${PARTITION:=1}`"
CYL=`echo "$FDISK_OUT" | sed -ne "s_^$LOOPDEVICE[ *]*\([0-9]*\).*_\1_p"`
@@ -25,7 +37,7 @@ echo loop $DEVICE at offset $OFFSET
if [ "${PARTITION}" = "0" ]
then
- losetup "${DEVICE}" "${FILE}"
+ ${LH_LOSETUP} "${DEVICE}" "${FILE}"
else
- losetup -o "${OFFSET}" "${DEVICE}" "${FILE}"
+ ${LH_LOSETUP} -o "${OFFSET}" "${DEVICE}" "${FILE}"
fi