2011-09-11 10:22:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# TODO: make dest not hardcoded
|
|
|
|
|
|
|
|
NAME=$1
|
2011-09-11 22:42:17 +00:00
|
|
|
DEST="/nfs/$NAME"
|
2011-09-11 10:22:13 +00:00
|
|
|
|
|
|
|
# remove old nfs filesystem if one exists
|
|
|
|
rm -rf $DEST
|
|
|
|
|
|
|
|
# build a proto image - natty + packages that will install (optimization)
|
2011-09-11 23:23:21 +00:00
|
|
|
if [ ! -d proto ]; then
|
2011-09-11 22:42:17 +00:00
|
|
|
debootstrap natty proto
|
2011-09-11 23:34:34 +00:00
|
|
|
cp files/sources.list proto/etc/apt/sources.list
|
2011-09-11 22:42:17 +00:00
|
|
|
chroot proto apt-get update
|
2011-09-11 23:23:21 +00:00
|
|
|
chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin)"`
|
|
|
|
chroot proto pip install `cat pips/*`
|
2011-09-11 22:42:17 +00:00
|
|
|
git clone https://github.com/cloudbuilders/nova.git proto/opt/nova
|
|
|
|
git clone https://github.com/cloudbuilders/openstackx.git proto/opt/openstackx
|
|
|
|
git clone https://github.com/cloudbuilders/noVNC.git proto/opt/noVNC
|
|
|
|
git clone https://github.com/cloudbuilders/openstack-dashboard.git proto/opt/dash
|
|
|
|
git clone https://github.com/cloudbuilders/python-novaclient.git proto/opt/python-novaclient
|
|
|
|
git clone https://github.com/cloudbuilders/keystone.git proto/opt/keystone
|
|
|
|
git clone https://github.com/cloudbuilders/glance.git proto/opt/glance
|
2011-09-11 23:46:44 +00:00
|
|
|
wget -c http://images.ansolabs.com/tty.tgz -O proto/opt/tty.tgz
|
2011-09-11 10:22:13 +00:00
|
|
|
fi
|
|
|
|
|
2011-09-11 22:42:17 +00:00
|
|
|
cp -pr proto $DEST
|
2011-09-11 10:22:13 +00:00
|
|
|
|
|
|
|
# set hostname
|
|
|
|
echo $NAME > $DEST/etc/hostname
|
|
|
|
echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts
|
|
|
|
|
|
|
|
# copy kernel modules
|
|
|
|
cp -pr /lib/modules/`uname -r` $DEST/lib/modules
|
|
|
|
|
2011-09-12 00:53:34 +00:00
|
|
|
# inject stack.sh files
|
|
|
|
cp -r files $DEST/opt/files
|
2011-09-11 23:34:34 +00:00
|
|
|
|
2011-09-11 10:22:13 +00:00
|
|
|
# copy openstack installer and requirement lists to a new directory.
|
|
|
|
mkdir -p $DEST/opt
|
|
|
|
cp stack.sh $DEST/opt/stack.sh
|
|
|
|
cp -r pips $DEST/opt
|
|
|
|
cp -r apts $DEST/opt
|
|
|
|
|
2011-09-11 23:34:34 +00:00
|
|
|
# injecting root's public ssh key if it exists
|
|
|
|
if [ -f /root/.ssh/id_rsa.pub ]; then
|
|
|
|
mkdir $DEST/root/.ssh
|
|
|
|
chmod 700 $DEST/root/.ssh
|
|
|
|
cp /root/.ssh/id_rsa.pub $DEST/root/.ssh/authorized_keys
|
|
|
|
fi
|
2011-09-11 10:22:13 +00:00
|
|
|
|
|
|
|
# set root password to password
|
|
|
|
echo root:password | chroot $DEST chpasswd
|
|
|
|
|