aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReto Buerki <reet@codelabs.ch>2012-12-06 17:42:51 +0100
committerTobias Brunner <tobias@strongswan.org>2013-01-17 15:22:10 +0100
commit2d1577d661c02753ad7c9b34f993a7c340706679 (patch)
treebfcfd7ac0f8d32dda5a39344de67151aefc06532
parentbf3ff0e585a651c4ba61d26146923538af7170ac (diff)
downloadstrongswan-2d1577d661c02753ad7c9b34f993a7c340706679.tar.bz2
strongswan-2d1577d661c02753ad7c9b34f993a7c340706679.tar.xz
Update build-umlhostfs script to new log format
-rwxr-xr-xtesting/make-testing1
-rwxr-xr-xtesting/scripts/build-umlhostfs72
2 files changed, 31 insertions, 42 deletions
diff --git a/testing/make-testing b/testing/make-testing
index 89a3db1a1..cd749b29c 100755
--- a/testing/make-testing
+++ b/testing/make-testing
@@ -72,6 +72,5 @@ fi
#
if [ $ENABLE_BUILD_UMLHOSTFS = "yes" ]
then
- cecho "Building uml host images (scripts/build-umlhostfs)"
$DIR/scripts/build-umlhostfs $HOSTS
fi
diff --git a/testing/scripts/build-umlhostfs b/testing/scripts/build-umlhostfs
index 9c309f545..d5b347973 100755
--- a/testing/scripts/build-umlhostfs
+++ b/testing/scripts/build-umlhostfs
@@ -14,60 +14,50 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
+echo "Creating guest images"
+
DIR=`dirname $0`
-source $DIR/function.sh
+. $DIR/function.sh
-[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found."
+[ `id -u` -eq 0 ] || die "You must be root to run $0"
-source $DIR/../testing.conf
+[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
+. $DIR/../testing.conf
cd $BUILDDIR/root-fs
BASE=$BUILDDIR/base.img
-[ -f $BASE ] || die "!! Base image $BASE not found."
-
-if [ ! -d $BUILDDIR ]
-then
- cecho-n " * Directory '$BUILDDIR' does not exist..creating.."
- mkdir $BUILDDIR
- cgecho "done"
-fi
-
-if [ ! -d $LOOPDIR ]
-then
- mkdir $LOOPDIR
-fi
+[ -f $BASE ] || die "Base image $BASE not found"
-cecho-n " * Creating root filesystem for.."
+mkdir -p $BUILDDIR
+mkdir -p $LOOPDIR
-if [ "$#" -eq 0 ]
-then
- HOSTS=$STRONGSWANHOSTS
+if [ "$#" -eq 0 ]; then
+ HOSTS=$STRONGSWANHOSTS
else
- HOSTS=$*
+ HOSTS=$*
fi
for host in $HOSTS
do
- cecho-n "$host.."
- cp $BASE $host.img
- mount -o loop $host.img $LOOPDIR
- cp -rf $BUILDDIR/hosts/${host}/etc $LOOPDIR
- if [ "$host" = "winnetou" ]
- then
- mkdir $LOOPDIR/var/log/apache2/ocsp
- cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/
- chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/certs
- chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1
- chroot $LOOPDIR update-rc.d apache2 defaults >> $LOGFILE 2>&1
- chroot $LOOPDIR update-rc.d slapd defaults >> $LOGFILE 2>&1
- chroot $LOOPDIR rm -rf /var/lib/ldap/*
- chroot $LOOPDIR slapadd -l /etc/ldap/ldif.txt -f /etc/ldap/slapd.conf >> $LOGFILE 2>&1
- chroot $LOOPDIR chown -R openldap:openldap /var/lib/ldap >> $LOGFILE 2>&1
- fi
- sync
- umount $LOOPDIR
+ log_action "Creating guest image for $host"
+ execute "cp $BASE $host.img" 0
+ execute "mount -o loop $host.img $LOOPDIR" 0
+ execute "cp -rf $BUILDDIR/hosts/${host}/etc $LOOPDIR" 0
+ if [ "$host" = "winnetou" ]
+ then
+ execute "mkdir $LOOPDIR/var/log/apache2/ocsp" 0
+ execute "cp -rf $UMLTESTDIR/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
+ umount $LOOPDIR
+ log_status 0
done
-
-cgecho "done"