blob: 7c98f6fd279296b77738282f31859a6296d79dda [file] [log] [blame]
Jesse Andrewsba23cc72011-09-11 03:22:13 -07001#!/bin/bash
2
3# TODO: make dest not hardcoded
4
5NAME=$1
6DEST="/boxes/$NAME/nfs"
7
8mkdir -p /boxes/$NAME
9
10# remove old nfs filesystem if one exists
11rm -rf $DEST
12
13# build a proto image - natty + packages that will install (optimization)
14if [ ! -d nfs ]; then
15 debootstrap natty nfs
16 cp sources.list nfs/etc/apt/sources.list
17 chroot nfs apt-get update
Jesse Andrews8622bf22011-09-11 15:27:54 -070018 chroot nfs apt-get install -y `cat apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt)"`
19 chroot nfs pip install `cat pips/* | cut -d\# -f1`
Jesse Andrewsba23cc72011-09-11 03:22:13 -070020 git clone https://github.com/cloudbuilders/nova.git nfs/opt/nova
21 git clone https://github.com/cloudbuilders/openstackx.git nfs/opt/openstackx
22 git clone https://github.com/cloudbuilders/noVNC.git nfs/opt/noVNC
23 git clone https://github.com/cloudbuilders/openstack-dashboard.git nfs/opt/dash
24 git clone https://github.com/cloudbuilders/python-novaclient.git nfs/opt/python-novaclient
25 git clone https://github.com/cloudbuilders/keystone.git nfs/opt/keystone
26 git clone https://github.com/cloudbuilders/glance.git nfs/opt/glance
27fi
28
29cp -pr nfs $DEST
30
31# set hostname
32echo $NAME > $DEST/etc/hostname
33echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts
34
35# copy kernel modules
36cp -pr /lib/modules/`uname -r` $DEST/lib/modules
37
38# copy openstack installer and requirement lists to a new directory.
39mkdir -p $DEST/opt
40cp stack.sh $DEST/opt/stack.sh
41cp -r pips $DEST/opt
42cp -r apts $DEST/opt
43
44# injecting root's ssh key
45# FIXME: only do this if id_rsa.pub exists
46mkdir $DEST/root/.ssh
47chmod 700 $DEST/root/.ssh
48cp /root/.ssh/id_rsa.pub $DEST/root/.ssh/authorized_keys
49
50# set root password to password
51echo root:password | chroot $DEST chpasswd
52