diff options
author | Reto Buerki <reet@codelabs.ch> | 2012-12-10 10:33:19 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-01-17 16:54:55 +0100 |
commit | 90dd71e41c612211027963764b6993b861edd3f9 (patch) | |
tree | 322bc536efbcaefe2a44bf2969d2574111de45c6 /testing/scripts/build-rootimage | |
parent | 258cbd40cff463f4adb57f40d3338e460c7e90f2 (diff) | |
download | strongswan-90dd71e41c612211027963764b6993b861edd3f9.tar.bz2 strongswan-90dd71e41c612211027963764b6993b861edd3f9.tar.xz |
Rename build-umlrootfs script to build-rootimg
Diffstat (limited to 'testing/scripts/build-rootimage')
-rwxr-xr-x | testing/scripts/build-rootimage | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/scripts/build-rootimage b/testing/scripts/build-rootimage new file mode 100755 index 000000000..1890c4eed --- /dev/null +++ b/testing/scripts/build-rootimage @@ -0,0 +1,64 @@ +#!/bin/bash +# Create guest root image +# +# 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 "Building root image" + +. $PWD/scripts/function.sh + +[ `id -u` -eq 0 ] || die "You must be root to run $0" +[ -f "$BASEIMG" ] || die "Base image $BASEIMG not found" + +check_commands partprobe qemu-nbd + +load_qemu_nbd + +mkdir -p $LOOPDIR +mkdir -p $ROOTIMGCOMPILEDIR + +log_action "Creating root image $ROOTIMG" +execute "cp $BASEIMG $ROOTIMG" + +log_action "Connecting root image to NBD device $NBDEV" +execute "qemu-nbd -c $NBDEV $ROOTIMG" +do_on_exit qemu-nbd -d $NBDEV +partprobe $NBDEV + +log_action "Mounting $NBDPARTITION to $LOOPDIR" +execute "mount $NBDPARTITION $LOOPDIR" +do_on_exit umount $LOOPDIR + +log_action "Mounting proc filesystem to $LOOPDIR/proc" +execute "mount -t proc none $LOOPDIR/proc" +do_on_exit umount $LOOPDIR/proc + +mkdir -p $LOOPDIR/root/compile +log_action "Mounting $ROOTIMGCOMPILEDIR as /root/compile" +execute "mount -o bind $ROOTIMGCOMPILEDIR $LOOPDIR/root/compile" +do_on_exit umount $LOOPDIR/root/compile + +echo "Installing software from source" +RECPDIR=$TESTDIR/testing/scripts/recipes +RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename` +execute "cp -r $RECPDIR/patches $LOOPDIR/root/compile" 0 +for r in $RECIPES +do + cp $RECPDIR/$r ${LOOPDIR}/root/compile + log_action "Installing from recipe $r" + execute_chroot "make SWANVERSION=$SWANVERSION -C /root/compile -f $r" +done + +log_action "Removing /etc/resolv.conf" +execute "rm -f $LOOPDIR/etc/resolv.conf" |