blob: 1523eceb09e0be2bf90cd34e5b87633b9e747163 [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 Andrews3107deb2011-09-11 16:46:44 -070025 wget -c http://images.ansolabs.com/tty.tgz -O proto/opt/tty.tgz
Jesse Andrewsba23cc72011-09-11 03:22:13 -070026fi
27
Jesse Andrews1639ed62011-09-11 15:42:17 -070028cp -pr proto $DEST
Jesse Andrewsba23cc72011-09-11 03:22:13 -070029
30# set hostname
31echo $NAME > $DEST/etc/hostname
32echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts
33
34# copy kernel modules
35cp -pr /lib/modules/`uname -r` $DEST/lib/modules
36
Jesse Andrews8b564a82011-09-11 17:53:34 -070037# inject stack.sh files
38cp -r files $DEST/opt/files
Jesse Andrews5f098202011-09-11 16:34:34 -070039
Jesse Andrewsba23cc72011-09-11 03:22:13 -070040# copy openstack installer and requirement lists to a new directory.
41mkdir -p $DEST/opt
42cp stack.sh $DEST/opt/stack.sh
43cp -r pips $DEST/opt
44cp -r apts $DEST/opt
45
Jesse Andrews5f098202011-09-11 16:34:34 -070046# injecting root's public ssh key if it exists
47if [ -f /root/.ssh/id_rsa.pub ]; then
48 mkdir $DEST/root/.ssh
49 chmod 700 $DEST/root/.ssh
50 cp /root/.ssh/id_rsa.pub $DEST/root/.ssh/authorized_keys
51fi
Jesse Andrewsba23cc72011-09-11 03:22:13 -070052
53# set root password to password
54echo root:password | chroot $DEST chpasswd
55