aboutsummaryrefslogtreecommitdiffstats
path: root/testing/scripts/build-umlhostfs
diff options
context:
space:
mode:
authorReto Buerki <reet@codelabs.ch>2012-12-07 17:54:19 +0100
committerTobias Brunner <tobias@strongswan.org>2013-01-17 16:54:54 +0100
commit8ed98c137321c3f92fb06b58e69aaecf4e531cdc (patch)
tree0dca4366a75f5b44dd55d9026a97312005fe3f8c /testing/scripts/build-umlhostfs
parent7fa27191855eaf828ec3dcf90385e0782f74d2e2 (diff)
downloadstrongswan-8ed98c137321c3f92fb06b58e69aaecf4e531cdc.tar.bz2
strongswan-8ed98c137321c3f92fb06b58e69aaecf4e531cdc.tar.xz
Switch from raw images to qcow2 format
This allows to use minimal copy-on-write clones of the base image as guest images, which in turn saves a lot of disk space.
Diffstat (limited to 'testing/scripts/build-umlhostfs')
-rwxr-xr-xtesting/scripts/build-umlhostfs15
1 files changed, 10 insertions, 5 deletions
diff --git a/testing/scripts/build-umlhostfs b/testing/scripts/build-umlhostfs
index 9c419ac9b..1028ef266 100755
--- a/testing/scripts/build-umlhostfs
+++ b/testing/scripts/build-umlhostfs
@@ -1,5 +1,5 @@
#!/bin/bash
-# create UML host file systems
+# create specific guest images
#
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
# Zuercher Hochschule Winterthur
@@ -20,12 +20,14 @@ echo "Creating guest images"
[ `id -u` -eq 0 ] || die "You must be root to run $0"
-BASE=$BUILDDIR/base.img
+BASE=$BUILDDIR/base.qcow2
HOSTSDIR=$PWD/hosts
[ -f $BASE ] || die "Base image $BASE not found"
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
+load_qemu_nbd
+
mkdir -p $BUILDDIR
mkdir -p $LOOPDIR
@@ -41,8 +43,10 @@ do_on_exit umount $LOOPDIR
for host in $HOSTS
do
log_action "Creating guest image for $host"
- execute "cp $BASE $ROOTFSDIR/$host.img" 0
- execute "mount -o loop $ROOTFSDIR/$host.img $LOOPDIR" 0
+ execute "qemu-img create -b $BASE -f qcow2 $ROOTFSDIR/$host.qcow2" 0
+ execute "qemu-nbd -c $NBDEV $ROOTFSDIR/$host.qcow2" 0
+ sync
+ execute "mount $NBDPARTITION $LOOPDIR" 0
execute "cp -rf $HOSTSDIR/${host}/etc $LOOPDIR" 0
execute "cp -rf $HOSTSDIR/default/etc $LOOPDIR" 0
if [ "$host" = "winnetou" ]
@@ -58,6 +62,7 @@ do
execute_chroot "chown -R openldap:openldap /var/lib/ldap" 0
fi
sync
+ execute "umount $LOOPDIR" 0
+ execute "qemu-nbd -d $NBDEV" 0
log_status 0
- umount $LOOPDIR
done