mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-08 00:02:03 -04:00
64 lines
1.9 KiB
Bash
Executable File
64 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# create UML host file systems
|
|
#
|
|
# 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 <http://www.fsf.org/copyleft/gpl.txt>.
|
|
#
|
|
# 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"
|
|
|
|
BASE=$BUILDDIR/base.img
|
|
HOSTSDIR=$PWD/hosts
|
|
|
|
[ -f $BASE ] || die "Base image $BASE not found"
|
|
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
|
|
|
|
mkdir -p $BUILDDIR
|
|
mkdir -p $LOOPDIR
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
HOSTS=$STRONGSWANHOSTS
|
|
else
|
|
HOSTS=$*
|
|
fi
|
|
|
|
# just to be sure
|
|
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 "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 $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
|
|
log_status 0
|
|
umount $LOOPDIR
|
|
done
|