Copy devstack into image

This commit is contained in:
Dean Troyer 2011-10-03 09:56:41 -05:00
parent 11e5e6fc3d
commit 03412c8cb9
2 changed files with 25 additions and 19 deletions

View file

@ -6,10 +6,12 @@ CHROOTCACHE=${CHROOTCACHE:-/root/cache}
# Source params # Source params
source ./stackrc source ./stackrc
# TODO: make dest not hardcoded # Store cwd
CWD=`pwd`
NAME=$1 NAME=$1
DEST="/nfs/$NAME" NFSDIR="/nfs/$NAME"
DEST=${DEST:-/opt/stack}
# remove old nfs filesystem if one exists # remove old nfs filesystem if one exists
rm -rf $DEST rm -rf $DEST
@ -92,26 +94,21 @@ git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH
chroot $CHROOTCACHE/natty-stack mkdir -p $DEST/files chroot $CHROOTCACHE/natty-stack mkdir -p $DEST/files
wget -c http://images.ansolabs.com/tty.tgz -O $CHROOTCACHE/natty-stack$DEST/files/tty.tgz wget -c http://images.ansolabs.com/tty.tgz -O $CHROOTCACHE/natty-stack$DEST/files/tty.tgz
cp -pr $CHROOTCACHE/natty-stack $DEST # Use this version of devstack?
if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
rm -rf $$CHROOTCACHE/natty-stack/$DEST/devstack
cp -pr $CWD $CHROOTCACHE/natty-stack/$DEST/devstack
fi
cp -pr $CHROOTCACHE/natty-stack $NFSDIR
# set hostname # set hostname
echo $NAME > $DEST/etc/hostname echo $NAME > $NFSDIR/etc/hostname
echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts echo "127.0.0.1 localhost $NAME" > $NFSDIR/etc/hosts
# copy kernel modules
cp -pr /lib/modules/`uname -r` $DEST/lib/modules
# copy openstack installer and requirement lists to a new directory.
mkdir -p $DEST/opt
# inject stack.sh and dependant files
cp -r files $DEST/opt/files
cp stack.sh $DEST/opt/stack.sh
# injecting root's public ssh key if it exists # injecting root's public ssh key if it exists
if [ -f /root/.ssh/id_rsa.pub ]; then if [ -f /root/.ssh/id_rsa.pub ]; then
mkdir $DEST/root/.ssh mkdir $NFSDIR/root/.ssh
chmod 700 $DEST/root/.ssh chmod 700 $NFSDIR/root/.ssh
cp /root/.ssh/id_rsa.pub $DEST/root/.ssh/authorized_keys cp /root/.ssh/id_rsa.pub $NFSDIR/root/.ssh/authorized_keys
fi fi

View file

@ -12,6 +12,9 @@ CHROOTCACHE=${CHROOTCACHE:-/root/cache}
# Source params # Source params
source ./stackrc source ./stackrc
# Store cwd
CWD=`pwd`
DEST=${DEST:-/opt/stack} DEST=${DEST:-/opt/stack}
# clean install of natty # clean install of natty
@ -89,6 +92,12 @@ git_clone $DASH_REPO $DEST/dash $DASH_BRANCH
git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH
git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH
# Use this version of devstack?
if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
rm -rf $CACHEDIR/$DEST/devstack
cp -pr $CWD $CACHEDIR/$DEST/devstack
fi
# build a new image # build a new image
BASE=build.$$ BASE=build.$$
IMG=$BASE.img IMG=$BASE.img