From: Reto Buerki Date: Mon, 10 Dec 2012 09:38:27 +0000 (+0100) Subject: Rename build-umlhostfs script to build-guestimages X-Git-Tag: 5.0.2rc1~1^2~56 X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=commitdiff_plain;h=44e83859e0819c86d10007380da19829e3112f51 Rename build-umlhostfs script to build-guestimages --- diff --git a/testing/make-testing b/testing/make-testing index 1980e3b..2daf131 100755 --- a/testing/make-testing +++ b/testing/make-testing @@ -19,7 +19,7 @@ then $PWD/scripts/build-guestkernel || exit 1 fi -if [ $ENABLE_BUILD_UMLHOSTFS = "yes" ] +if [ $ENABLE_BUILD_GUESTIMAGES = "yes" ] then - $PWD/scripts/build-umlhostfs $HOSTS || exit 1 + $PWD/scripts/build-guestimages $HOSTS || exit 1 fi diff --git a/testing/scripts/build-guestimages b/testing/scripts/build-guestimages new file mode 100755 index 0000000..adcc522 --- /dev/null +++ b/testing/scripts/build-guestimages @@ -0,0 +1,70 @@ +#!/bin/bash +# create specific guest images +# +# Copyright (C) 2004 Eric Marchionni, Patrik Rayo +# Zuercher Hochschule Winterthur +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. See . +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. + +echo "Creating guest images" + +. $PWD/scripts/function.sh + +HOSTSDIR=$PWD/hosts + +[ `id -u` -eq 0 ] || die "You must be root to run $0" +[ -f $ROOTIMG ] || die "Root image $ROOTIMG not found" +[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found" + +check_commands partprobe qemu-img qemu-nbd + +load_qemu_nbd + +mkdir -p $BUILDDIR +mkdir -p $LOOPDIR +mkdir -p $GUESTIMGDIR + +if [ "$#" -eq 0 ]; then + HOSTS=$STRONGSWANHOSTS +else + HOSTS=$* +fi + +# just to be sure +do_on_exit qemu-nbd -d $NBDEV +do_on_exit umount $LOOPDIR + +for host in $HOSTS +do + log_action "Creating guest image for $host" + 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 + execute "cp -rf $HOSTSDIR/default/etc $LOOPDIR" 0 + if [ "$host" = "winnetou" ] + then + execute "mkdir $LOOPDIR/var/log/apache2/ocsp" 0 + execute "cp -rf $TESTDIR/testing/images $LOOPDIR/var/www/" 0 + execute_chroot "ln -s /etc/openssl/certs /var/www/certs" 0 + execute_chroot "/etc/openssl/generate-crl" 0 + execute_chroot "update-rc.d apache2 defaults" 0 + execute_chroot "update-rc.d slapd defaults" 0 + execute_chroot "rm -rf /var/lib/ldap/*" 0 + execute_chroot "slapadd -l /etc/ldap/ldif.txt -f /etc/ldap/slapd.conf" 0 + 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 +done diff --git a/testing/scripts/build-umlhostfs b/testing/scripts/build-umlhostfs deleted file mode 100755 index fc2660c..0000000 --- a/testing/scripts/build-umlhostfs +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# create specific guest images -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See . -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -echo "Creating guest images" - -. $PWD/scripts/function.sh - -[ `id -u` -eq 0 ] || die "You must be root to run $0" - -HOSTSDIR=$PWD/hosts - -[ -f $ROOTIMG ] || die "Root image $ROOTIMG not found" -[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found" - -check_commands partprobe qemu-img qemu-nbd - -load_qemu_nbd - -mkdir -p $BUILDDIR -mkdir -p $LOOPDIR -mkdir -p $GUESTIMGDIR - -if [ "$#" -eq 0 ]; then - HOSTS=$STRONGSWANHOSTS -else - HOSTS=$* -fi - -# just to be sure -do_on_exit qemu-nbd -d $NBDEV -do_on_exit umount $LOOPDIR - -for host in $HOSTS -do - log_action "Creating guest image for $host" - 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 - execute "cp -rf $HOSTSDIR/default/etc $LOOPDIR" 0 - if [ "$host" = "winnetou" ] - then - execute "mkdir $LOOPDIR/var/log/apache2/ocsp" 0 - execute "cp -rf $TESTDIR/testing/images $LOOPDIR/var/www/" 0 - execute_chroot "ln -s /etc/openssl/certs /var/www/certs" 0 - execute_chroot "/etc/openssl/generate-crl" 0 - execute_chroot "update-rc.d apache2 defaults" 0 - execute_chroot "update-rc.d slapd defaults" 0 - execute_chroot "rm -rf /var/lib/ldap/*" 0 - execute_chroot "slapadd -l /etc/ldap/ldif.txt -f /etc/ldap/slapd.conf" 0 - 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 -done diff --git a/testing/testing.conf b/testing/testing.conf index 4ed5fdd..7b67c29 100644 --- a/testing/testing.conf +++ b/testing/testing.conf @@ -73,7 +73,7 @@ SSHCONF="-F $TESTDIR/testing/ssh_config" ENABLE_BUILD_BASEIMAGE="yes" ENABLE_BUILD_ROOTIMAGE="yes" ENABLE_BUILD_GUESTKERNEL="yes" -ENABLE_BUILD_UMLHOSTFS="yes" +ENABLE_BUILD_GUESTIMAGES="yes" ############################################################## # If set to "yes" only the tests stated at $SELECTEDTESTS