diff options
author | Daniel Baumann <daniel@debian.org> | 2007-09-23 10:04:47 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 18:18:28 +0100 |
commit | 677415f6d7efc1e5b888570d70af311d2900c69c (patch) | |
tree | 32fe7ced768666c229fff913fe12cbbf2fdd34e4 /helpers/lh_losetup | |
parent | 811ff0532fcb3305ebefcd1d61e4eb6c260902eb (diff) | |
download | vyos-live-build-677415f6d7efc1e5b888570d70af311d2900c69c.tar.gz vyos-live-build-677415f6d7efc1e5b888570d70af311d2900c69c.zip |
Adding live-helper 1.0~a2-1.
Diffstat (limited to 'helpers/lh_losetup')
-rwxr-xr-x | helpers/lh_losetup | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/helpers/lh_losetup b/helpers/lh_losetup index 442afdb87..94337acf4 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 |