mirror of
https://github.com/strongswan/strongswan.git
synced 2025-12-15 00:00:26 -05:00
Unify naming of base,root image settings
This commit is contained in:
parent
aba43136c2
commit
258cbd40cf
@ -23,17 +23,17 @@ APTCACHE=$LOOPDIR/var/cache/apt/archives
|
||||
mkdir -p $LOOPDIR
|
||||
mkdir -p $BUILDDIR
|
||||
mkdir -p $CACHEDIR
|
||||
rm -f $ROOTFS
|
||||
rm -f $BASEIMG
|
||||
|
||||
echo "`date`, building $ROOTFS" >>$LOGFILE
|
||||
echo "`date`, building $BASEIMG" >>$LOGFILE
|
||||
|
||||
load_qemu_nbd
|
||||
|
||||
log_action "Creating image $ROOTFS"
|
||||
execute "qemu-img create -f qcow2 $ROOTFS ${ROOTFSSIZE}M"
|
||||
log_action "Creating base image $BASEIMG"
|
||||
execute "qemu-img create -f $IMGEXT $BASEIMG ${BASEIMGSIZE}M"
|
||||
|
||||
log_action "Connecting image to NBD device $NBDEV"
|
||||
execute "qemu-nbd -c $NBDEV $ROOTFS"
|
||||
execute "qemu-nbd -c $NBDEV $BASEIMG"
|
||||
do_on_exit qemu-nbd -d $NBDEV
|
||||
|
||||
log_action "Partitioning disk"
|
||||
@ -61,8 +61,8 @@ mkdir -p $APTCACHE
|
||||
execute "mount -o bind $CACHEDIR $APTCACHE"
|
||||
do_on_exit graceful_umount $APTCACHE
|
||||
|
||||
log_action "Running debootstrap ($ROOTFSSUITE, $ROOTFSARCH)"
|
||||
execute "debootstrap --arch=$ROOTFSARCH --include=$INC --exclude $EXC $ROOTFSSUITE $LOOPDIR $ROOTFSMIRROR"
|
||||
log_action "Running debootstrap ($BASEIMGSUITE, $BASEIMGARCH)"
|
||||
execute "debootstrap --arch=$BASEIMGARCH --include=$INC --exclude $EXC $BASEIMGSUITE $LOOPDIR $BASEIMGMIRROR"
|
||||
|
||||
for service in $SERVICES
|
||||
do
|
||||
|
||||
@ -20,10 +20,9 @@ echo "Creating guest images"
|
||||
|
||||
[ `id -u` -eq 0 ] || die "You must be root to run $0"
|
||||
|
||||
BASE=$BUILDDIR/base.qcow2
|
||||
HOSTSDIR=$PWD/hosts
|
||||
|
||||
[ -f $BASE ] || die "Base image $BASE not found"
|
||||
[ -f $ROOTIMG ] || die "Root image $ROOTIMG not found"
|
||||
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
|
||||
|
||||
check_commands partprobe qemu-img qemu-nbd
|
||||
@ -32,6 +31,7 @@ load_qemu_nbd
|
||||
|
||||
mkdir -p $BUILDDIR
|
||||
mkdir -p $LOOPDIR
|
||||
mkdir -p $GUESTIMGDIR
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
HOSTS=$STRONGSWANHOSTS
|
||||
@ -46,8 +46,8 @@ do_on_exit umount $LOOPDIR
|
||||
for host in $HOSTS
|
||||
do
|
||||
log_action "Creating guest image for $host"
|
||||
execute "qemu-img create -b $BASE -f qcow2 $ROOTFSDIR/$host.qcow2" 0
|
||||
execute "qemu-nbd -c $NBDEV $ROOTFSDIR/$host.qcow2" 0
|
||||
execute "qemu-img create -b $ROOTIMG -f $IMGEXT $GUESTIMGDIR/$host.$IMGEXT" 0
|
||||
execute "qemu-nbd -c $NBDEV $GUESTIMGDIR/$host.$IMGEXT" 0
|
||||
partprobe $NBDEV
|
||||
execute "mount $NBDPARTITION $LOOPDIR" 0
|
||||
execute "cp -rf $HOSTSDIR/${host}/etc $LOOPDIR" 0
|
||||
|
||||
@ -20,23 +20,20 @@ echo "Building root image"
|
||||
|
||||
[ `id -u` -eq 0 ] || die "You must be root to run $0"
|
||||
|
||||
[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
|
||||
[ -f "$BASEIMG" ] || die "Base image $BASEIMG not found"
|
||||
|
||||
check_commands partprobe qemu-nbd
|
||||
|
||||
load_qemu_nbd
|
||||
|
||||
mkdir -p $ROOTFSDIR
|
||||
mkdir -p $LOOPDIR
|
||||
mkdir -p $ROOTFSCOMPILEDIR
|
||||
cd $ROOTFSDIR
|
||||
mkdir -p $ROOTIMGCOMPILEDIR
|
||||
|
||||
BASE=$BUILDDIR/base.qcow2
|
||||
log_action "Creating $BASE"
|
||||
execute "cp $ROOTFS $BASE"
|
||||
log_action "Creating root image $ROOTIMG"
|
||||
execute "cp $BASEIMG $ROOTIMG"
|
||||
|
||||
log_action "Connecting base image to NBD device $NBDEV"
|
||||
execute "qemu-nbd -c $NBDEV $BASE"
|
||||
log_action "Connecting root image to NBD device $NBDEV"
|
||||
execute "qemu-nbd -c $NBDEV $ROOTIMG"
|
||||
do_on_exit qemu-nbd -d $NBDEV
|
||||
partprobe $NBDEV
|
||||
|
||||
@ -49,8 +46,8 @@ execute "mount -t proc none $LOOPDIR/proc"
|
||||
do_on_exit umount $LOOPDIR/proc
|
||||
|
||||
mkdir -p $LOOPDIR/root/compile
|
||||
log_action "Mounting $ROOTFSCOMPILEDIR as /root/compile"
|
||||
execute "mount -o bind $ROOTFSCOMPILEDIR $LOOPDIR/root/compile"
|
||||
log_action "Mounting $ROOTIMGCOMPILEDIR as /root/compile"
|
||||
execute "mount -o bind $ROOTIMGCOMPILEDIR $LOOPDIR/root/compile"
|
||||
do_on_exit umount $LOOPDIR/root/compile
|
||||
|
||||
echo "Installing software from source"
|
||||
|
||||
@ -22,7 +22,7 @@ done
|
||||
|
||||
for host in $STRONGSWANHOSTS
|
||||
do
|
||||
ln -fs $ROOTFSDIR/$host.qcow2 $VIRTIMGSTORE/$host.qcow2
|
||||
ln -fs $GUESTIMGDIR/$host.$IMGEXT $VIRTIMGSTORE/$host.$IMGEXT
|
||||
log_action "Guest $host"
|
||||
execute "virsh create $CONFDIR/$host.xml"
|
||||
done
|
||||
|
||||
@ -19,7 +19,7 @@ for host in $STRONGSWANHOSTS
|
||||
do
|
||||
log_action "Guest $host"
|
||||
execute "virsh destroy $host"
|
||||
rm -f $VIRTIMGSTORE/$host.qcow2
|
||||
rm -f $VIRTIMGSTORE/$host.$IMGEXT
|
||||
done
|
||||
|
||||
log_action "Removing kernel $KERNEL"
|
||||
|
||||
@ -36,16 +36,25 @@ LOGFILE=$BUILDDIR/testing.log
|
||||
# Directory used for loop-mounts
|
||||
LOOPDIR=$BUILDDIR/loop
|
||||
|
||||
# Base image settings
|
||||
ROOTFSSIZE=1024
|
||||
ROOTFSSUITE=wheezy
|
||||
ROOTFSARCH=amd64
|
||||
ROOTFS=$BUILDDIR/debian-$ROOTFSSUITE-$ROOTFSARCH.qcow2
|
||||
ROOTFSMIRROR=http://cdn.debian.net/debian
|
||||
ROOTFSCOMPILEDIR=$BUILDDIR/compile
|
||||
# Image extension
|
||||
IMGEXT=qcow2
|
||||
|
||||
# Path to guest images
|
||||
ROOTFSDIR=$BUILDDIR/root-fs
|
||||
# Base image settings
|
||||
# The base image is a pristine OS installation created using debootstrap.
|
||||
BASEIMGSIZE=1024
|
||||
BASEIMGSUITE=wheezy
|
||||
BASEIMGARCH=amd64
|
||||
BASEIMG=$BUILDDIR/debian-$BASEIMGSUITE-$BASEIMGARCH.$IMGEXT
|
||||
BASEIMGMIRROR=http://cdn.debian.net/debian
|
||||
|
||||
# Root image settings
|
||||
# The root image is the origin of all guest images. It contains additional
|
||||
# test-specific software and patches.
|
||||
ROOTIMG=$BUILDDIR/root.$IMGEXT
|
||||
ROOTIMGCOMPILEDIR=$BUILDDIR/compile
|
||||
|
||||
# Guest images settings
|
||||
GUESTIMGDIR=$BUILDDIR/guest-images
|
||||
|
||||
# libvirt config
|
||||
NBDEV=/dev/nbd0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user