diff options
author | Jo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com> | 2015-09-09 10:56:40 +0200 |
---|---|---|
committer | Jo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com> | 2015-09-09 18:51:47 +0200 |
commit | 4f2fce70da878ad03dc77324f6916bfcae447e1e (patch) | |
tree | e02adb8340a60cf7f1fedc9db6be332190045936 /tools/yardstick-img-modify | |
parent | c00f0f4fdab37db3bf084c879ac6186054726916 (diff) |
Add support for building images on CentOS
This is a workaround for building on CentOS.
CentOS don't have nbd so guestfstool is used to mount the
ubuntu image.
The http sources has been changed to ftp as the apt-get
tool inside the Ubuntu image dont work well with http
sources when running on CentOS.
Change-Id: I23679ff034ea76782dcc73d3283cb70ebace5ee8
JIRA: YARDSTICK-136
Signed-off-by: Jo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>
Diffstat (limited to 'tools/yardstick-img-modify')
-rwxr-xr-x | tools/yardstick-img-modify | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify index eba85473c..c90027213 100755 --- a/tools/yardstick-img-modify +++ b/tools/yardstick-img-modify @@ -66,15 +66,22 @@ download() { cd - } -# mount image using qemu-nbd +# mount image setup() { - modprobe nbd max_part=16 - qemu-nbd -c /dev/nbd0 $imgfile - partprobe /dev/nbd0 - mkdir -p $mountdir - mount /dev/nbd0p1 $mountdir - + if [ -f /etc/centos-release ]; then + # CentOS, mount image using guestmount. + # (needs libguestfs-tools installed) + export LIBGUESTFS_BACKEND=direct + guestmount -a $imgfile -i --rw $mountdir + else + # mount image using qemu-nbd + modprobe nbd max_part=16 + qemu-nbd -c /dev/nbd0 $imgfile + partprobe /dev/nbd0 + + mount /dev/nbd0p1 $mountdir + fi cp $cmd $mountdir/$(basename $cmd) } |