Revision 494927a8

b/common.sh.in
187 187
        log_error "Can't find kpartx mapped partition: /dev/mapper/$filesystem_dev_base"
188 188
        exit 1
189 189
    fi
190
    echo "$filesystem_dev"
191
}
192

  
193
map_partition() {
194
    filesystem_dev="$1"
195
    partition="$2"
190 196
    if [ "${SWAP}" = "yes" -a -z "${KERNEL_PATH}" ] ; then
191
        boot_dev="${filesystem_base_dev}-1"
192
        swap_dev="${filesystem_base_dev}-2"
193
        root_dev="${filesystem_base_dev}-3"
197
        boot_dev="${filesystem_dev}-1"
198
        swap_dev="${filesystem_dev}-2"
199
        root_dev="${filesystem_dev}-3"
194 200
    elif [ "${SWAP}" = "no" -a -z "${KERNEL_PATH}" ] ; then
195
        boot_dev="${filesystem_base_dev}-1"
196
        root_dev="${filesystem_base_dev}-2"
201
        boot_dev="${filesystem_dev}-1"
202
        root_dev="${filesystem_dev}-2"
197 203
    elif [ "${SWAP}" = "yes" -a -n "${KERNEL_PATH}" ] ; then
198
        swap_dev="${filesystem_base_dev}-1"
199
        root_dev="${filesystem_base_dev}-2"
204
        swap_dev="${filesystem_dev}-1"
205
        root_dev="${filesystem_dev}-2"
200 206
    elif [ "${SWAP}" = "no" -a -n "${KERNEL_PATH}" ] ; then
201
        root_dev="${filesystem_base_dev}-1"
207
        root_dev="${filesystem_dev}-1"
202 208
    fi
203
    echo "$filesystem_dev"
209
    echo "$(eval "echo \${$(echo ${partition}_dev)"})"
204 210
}
205 211

  
206 212
unmap_disk0() {
b/create
55 55
        ${QEMU_IMG} convert ${IMAGE_FILE} -O host_device ${blockdev}
56 56
    fi
57 57

  
58
    filesystem_base_dev=$(map_disk0 $blockdev)
58
    filesystem_dev=$(map_disk0 $blockdev)
59 59
    CLEANUP+=("unmap_disk0 $blockdev")
60
    root_dev=$(map_partition $filesystem_dev root)
61
    boot_dev=$(map_partition $filesystem_dev boot)
62
    swap_dev=$(map_partition $filesystem_dev swap)
60 63

  
61 64
    if [ "${IMAGE_TYPE}" = "tarball" -o "${IMAGE_TYPE}" = "dump" ] ; then
62 65
        mkfs_disk0
b/export
31 31
    CLEANUP+=("$LOSETUP -d $blockdev")
32 32
fi
33 33

  
34
filesystem_base_dev=$(map_disk0 $blockdev)
34
filesystem_dev=$(map_disk0 $blockdev)
35 35
CLEANUP+=("unmap_disk0 $blockdev")
36
root_dev=$(map_partition $filesystem_dev root)
37
boot_dev=$(map_partition $filesystem_dev boot)
38

  
36 39

  
37 40
TARGET=`mktemp -d` || exit 1
38 41
CLEANUP+=("rmdir $TARGET")
b/import
32 32
fi
33 33

  
34 34
format_disk0 $blockdev
35
filesystem_base_dev=$(map_disk0 $blockdev)
35
filesystem_dev=$(map_disk0 $blockdev)
36 36
CLEANUP+=("unmap_disk0 $blockdev")
37
root_dev=$(map_partition $filesystem_dev root)
38
boot_dev=$(map_partition $filesystem_dev boot)
39
swap_dev=$(map_partition $filesystem_dev swap)
37 40

  
38 41
mkfs_disk0
39 42

  
b/rename
34 34
  CLEANUP+=("$LOSETUP -d $blockdev")
35 35
fi
36 36

  
37
filesystem_base_dev=$(map_disk0 $blockdev)
37
filesystem_dev=$(map_disk0 $blockdev)
38 38
CLEANUP+=("unmap_disk0 $blockdev")
39
root_dev=$(map_partition $filesystem_dev root)
40
boot_dev=$(map_partition $filesystem_dev boot)
39 41

  
40 42
mount_disk0 $TARGET
41 43
get_os_type

Also available in: Unified diff