]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Update build-umlhostfs script to new log format
authorReto Buerki <reet@codelabs.ch>
Thu, 6 Dec 2012 16:42:51 +0000 (17:42 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 17 Jan 2013 14:22:10 +0000 (15:22 +0100)
testing/make-testing
testing/scripts/build-umlhostfs

index 89a3db1a1e3cc2405533f56d98fd65b4396254c2..cd749b29c2d6f4b749b3702dd5ed8563ab584af8 100755 (executable)
@@ -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
index 9c309f5456f00bd83f6be9d14db0729fc70e6c83..d5b3479732d9f80c9cc5fb0f249eb3f72b7e8ddc 100755 (executable)
 # 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"