diff options
author | Reto Buerki <reet@codelabs.ch> | 2012-11-19 10:43:42 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-12-18 16:00:21 +0100 |
commit | aa5803e0e3368172d7674ff760983c568118df16 (patch) | |
tree | 000b01af72c7a8599c066224c7c819540124f428 /testing/scripts/build-baseimage | |
parent | 0080daa78789bb7012bc0f80dd6b4ff0d47e41a3 (diff) | |
download | strongswan-aa5803e0e3368172d7674ff760983c568118df16.tar.bz2 strongswan-aa5803e0e3368172d7674ff760983c568118df16.tar.xz |
testing: Switch to Debian based guest images
Instead of extracting a downloaded Gentoo filesystem tree into a file
containing a reiserfs filesystem, create an ext3 filesystem inside a
sparse file, mount it and debootstrap an up-to-date Debian system. Use
this image as base for all UML guest images.
Also, drop support for the various consoles and use xterm
unconditionally.
Diffstat (limited to 'testing/scripts/build-baseimage')
-rwxr-xr-x | testing/scripts/build-baseimage | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/testing/scripts/build-baseimage b/testing/scripts/build-baseimage new file mode 100755 index 000000000..bf6780f6c --- /dev/null +++ b/testing/scripts/build-baseimage @@ -0,0 +1,66 @@ +#!/bin/bash + +if [ `id -u` != 0 ]; +then + echo "! you must be root to run $0" + exit +fi + +DIR=`dirname $0` + +. $DIR/function.sh + +[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found" +. $DIR/../testing.conf + +execute() +{ + cmd=${1} + echo $cmd >>$LOGFILE + $cmd >>$LOGFILE 2>&1 + status=$? + if [ $status != 0 ]; then + echo "! command $cmd failed, exiting (status $status)" + echo "! check why here $LOGFILE" + exit 1 + fi +} + +# additional packages +EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb +SERVICES="isc-dhcp-server apache2 slapd" +PACKAGES=$EXTRAS,${SERVICES// /,} +CACHEDIR=$BUILDDIR/cache +APTCACHE=$LOOPDIR/var/cache/apt/archives + +mkdir -p $LOOPDIR +mkdir -p $BUILDDIR +mkdir -p $CACHEDIR +rm -f $ROOTFS + +echo "`date`, building $ROOTFS" >>$LOGFILE +echo " * Creating sparse image $ROOTFS ..." +execute "dd if=/dev/null of=$ROOTFS bs=1M seek=$ROOTFSSIZE count=1" +echo " * Creating ext3 filesystem ..." +execute "mkfs.ext3 -F $ROOTFS" +execute "mount -o loop $ROOTFS $LOOPDIR" +mkdir -p $APTCACHE +execute "mount -o bind $CACHEDIR $APTCACHE" + +echo " * Running debootstrap ..." +execute "debootstrap --arch=$ROOTFSARCH --include=$PACKAGES $ROOTFSSUITE $LOOPDIR $ROOTFSMIRROR" + +echo " * Setting root password to '$ROOTFSPW' ..." +echo root:$ROOTFSPW | chroot $LOOPDIR chpasswd + +echo " * Disabling services ..." +for service in $SERVICES +do + echo -n " - $service ... " + execute "chroot $LOOPDIR /etc/init.d/$service stop" + execute "chroot $LOOPDIR update-rc.d -f $service remove" + echo "done" +done + +execute "umount -l $APTCACHE" +execute "umount -l $LOOPDIR" |