2011-01-30 21:12:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
SUITE=lucid
|
|
|
|
ARCH=amd64
|
2011-03-21 00:43:01 +00:00
|
|
|
MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/archive.ubuntu.com/ubuntu
|
|
|
|
SECURITY_MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/security.ubuntu.com/ubuntu
|
2011-01-30 23:31:33 +00:00
|
|
|
|
2011-02-01 07:50:59 +00:00
|
|
|
usage() {
|
2011-03-20 01:09:36 +00:00
|
|
|
echo "Usage: ${0##*/} [OPTION]..."
|
2011-02-01 07:50:59 +00:00
|
|
|
echo "Make a base client."
|
|
|
|
echo
|
|
|
|
cat << EOF
|
|
|
|
--help display this help and exit
|
|
|
|
--suite=U build suite U instead of lucid
|
|
|
|
--arch=A build architecture A (e.g. i386) instead of amd64
|
|
|
|
|
|
|
|
The MIRROR_HOST environment variable can be used to change the
|
|
|
|
apt-cacher host. It should be something that the target VM can
|
2011-03-21 00:43:01 +00:00
|
|
|
resolve. It may be set to 127.0.0.1, in which case it will be
|
|
|
|
changed to 10.0.2.2 on the guest. 10.0.2.2 is the host IP as visible
|
|
|
|
from the guest under qemu networking.
|
2011-02-01 07:50:59 +00:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $# != 0 ] ; then
|
|
|
|
while true ; do
|
|
|
|
case "$1" in
|
|
|
|
--help|-h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--suite|-s)
|
|
|
|
SUITE="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
--arch|-a)
|
|
|
|
ARCH="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
--*)
|
|
|
|
echo "unrecognized option $1"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2011-01-30 23:31:33 +00:00
|
|
|
mkdir -p var
|
2011-01-30 21:12:02 +00:00
|
|
|
|
|
|
|
if [ ! -e var/id_dsa ]; then
|
|
|
|
ssh-keygen -t dsa -f var/id_dsa -N ""
|
|
|
|
fi
|
2011-02-01 07:50:59 +00:00
|
|
|
|
|
|
|
OUT=base-$SUITE-$ARCH
|
|
|
|
if [ -e $OUT.qcow2 ]; then
|
|
|
|
echo $OUT.qcow2 already exists, please remove it first
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $OUT
|
|
|
|
|
2011-03-21 00:43:01 +00:00
|
|
|
sudo vmbuilder kvm ubuntu --arch=$ARCH --suite=$SUITE --addpkg=openssh-server,pciutils,build-essential,git-core,subversion --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=virtual --firstboot=`pwd`/target-bin/bootstrap-fixup
|
2011-02-01 07:50:59 +00:00
|
|
|
|
|
|
|
mv $OUT/*.qcow2 $OUT.qcow2
|
|
|
|
|
|
|
|
rm -rf $OUT
|