blob: beb964cb8e8bcdb7ec77bb2e10f61079763a25bd [file] [log] [blame]
Jesse Andrewsba23cc72011-09-11 03:22:13 -07001#!/bin/bash
2
3# TODO: make dest not hardcoded
4
5NAME=$1
Jesse Andrews1639ed62011-09-11 15:42:17 -07006DEST="/nfs/$NAME"
Jesse Andrewsba23cc72011-09-11 03:22:13 -07007
8# remove old nfs filesystem if one exists
9rm -rf $DEST
10
11# build a proto image - natty + packages that will install (optimization)
Jesse Andrewsf2ef7602011-09-11 16:23:21 -070012if [ ! -d proto ]; then
Jesse Andrews1639ed62011-09-11 15:42:17 -070013 debootstrap natty proto
Jesse Andrews5f098202011-09-11 16:34:34 -070014 cp files/sources.list proto/etc/apt/sources.list
Jesse Andrews1639ed62011-09-11 15:42:17 -070015 chroot proto apt-get update
Jesse Andrewsf2ef7602011-09-11 16:23:21 -070016 chroot proto apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin)"`
17 chroot proto pip install `cat pips/*`
Jesse Andrews1639ed62011-09-11 15:42:17 -070018 git clone https://github.com/cloudbuilders/nova.git proto/opt/nova
19 git clone https://github.com/cloudbuilders/openstackx.git proto/opt/openstackx
20 git clone https://github.com/cloudbuilders/noVNC.git proto/opt/noVNC
21 git clone https://github.com/cloudbuilders/openstack-dashboard.git proto/opt/dash
22 git clone https://github.com/cloudbuilders/python-novaclient.git proto/opt/python-novaclient
23 git clone https://github.com/cloudbuilders/keystone.git proto/opt/keystone
24 git clone https://github.com/cloudbuilders/glance.git proto/opt/glance
Jesse Andrewsba23cc72011-09-11 03:22:13 -070025fi
26
Jesse Andrews1639ed62011-09-11 15:42:17 -070027cp -pr proto $DEST
Jesse Andrewsba23cc72011-09-11 03:22:13 -070028
29# set hostname
30echo $NAME > $DEST/etc/hostname
31echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts
32
33# copy kernel modules
34cp -pr /lib/modules/`uname -r` $DEST/lib/modules
35
Jesse Andrews5f098202011-09-11 16:34:34 -070036# helpful screenrc
37cp files/screenrc $DEST/root/.screenrc
38
Jesse Andrewsba23cc72011-09-11 03:22:13 -070039# copy openstack installer and requirement lists to a new directory.
40mkdir -p $DEST/opt
41cp stack.sh $DEST/opt/stack.sh
42cp -r pips $DEST/opt
43cp -r apts $DEST/opt
44
Jesse Andrews5f098202011-09-11 16:34:34 -070045# injecting root's public ssh key if it exists
46if [ -f /root/.ssh/id_rsa.pub ]; then
47 mkdir $DEST/root/.ssh
48 chmod 700 $DEST/root/.ssh
49 cp /root/.ssh/id_rsa.pub $DEST/root/.ssh/authorized_keys
50fi
Jesse Andrewsba23cc72011-09-11 03:22:13 -070051
52# set root password to password
53echo root:password | chroot $DEST chpasswd
54