~asac/live-build/live-helper.install-kernel-with-no-initramfs

« back to all changes in this revision

Viewing changes to helpers/lh_losetup

  • Committer: Daniel Baumann
  • Date: 2007-09-23 08:04:47 UTC
  • Revision ID: git-v1:f4383da69d4642521cb07f8f970d9c9c759b44ee
Tags: 1.0_a2-1
Adding live-helper 1.0~a2-1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# lh_losetup <device> <file> <partition>
4
4
 
 
5
set -e
 
6
 
 
7
# Source common functions
 
8
for FUNCTION in /usr/share/live-helper/functions/*.sh
 
9
do
 
10
        . ${FUNCTION}
 
11
done
 
12
 
 
13
# Reading configuration files
 
14
Read_conffile config/common
 
15
Set_defaults
 
16
 
5
17
if [ -z "${1}" ]
6
18
then
7
 
        DEVICE="`losetup -f`"
 
19
        DEVICE="`${LH_LOSETUP} -f`"
8
20
else
9
21
        DEVICE="${1}"
10
22
fi
12
24
FILE="${2}"
13
25
PARTITION="${3}"
14
26
 
15
 
losetup "${DEVICE}" "${FILE}"
 
27
${LH_LOSETUP} "${DEVICE}" "${FILE}"
16
28
FDISK_OUT="`fdisk -l -u ${DEVICE} 2>&1`"
17
 
losetup -d "${DEVICE}"
 
29
${LH_LOSETUP} -d "${DEVICE}"
18
30
 
19
31
LOOPDEVICE="`echo ${DEVICE}p${PARTITION:=1}`"
20
32
CYL=`echo "$FDISK_OUT" | sed -ne "s_^$LOOPDEVICE[ *]*\([0-9]*\).*_\1_p"`
25
37
 
26
38
if [ "${PARTITION}" = "0" ]
27
39
then
28
 
        losetup "${DEVICE}" "${FILE}"
 
40
        ${LH_LOSETUP} "${DEVICE}" "${FILE}"
29
41
else
30
 
        losetup -o "${OFFSET}" "${DEVICE}" "${FILE}"
 
42
        ${LH_LOSETUP} -o "${OFFSET}" "${DEVICE}" "${FILE}"
31
43
fi