devstack_custom/build_nfs.sh

56 lines
1.8 KiB
Bash
Raw Normal View History

#!/bin/bash
# TODO: make dest not hardcoded
NAME=$1
2011-09-11 22:42:17 +00:00
DEST="/nfs/$NAME"
# remove old nfs filesystem if one exists
rm -rf $DEST
# build a proto image - natty + packages that will install (optimization)
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-13 02:29:56 +00:00
chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
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
wget -c http://images.ansolabs.com/tty.tgz -O proto/opt/tty.tgz
fi
2011-09-11 22:42:17 +00:00
cp -pr proto $DEST
# 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
# 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
# set root password to password
echo root:password | chroot $DEST chpasswd