Jesse Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # TODO: make dest not hardcoded |
| 4 | |
| 5 | NAME=$1 |
| 6 | DEST="/boxes/$NAME/nfs" |
| 7 | |
| 8 | mkdir -p /boxes/$NAME |
| 9 | |
| 10 | # remove old nfs filesystem if one exists |
| 11 | rm -rf $DEST |
| 12 | |
| 13 | # build a proto image - natty + packages that will install (optimization) |
| 14 | if [ ! -d nfs ]; then |
| 15 | debootstrap natty nfs |
| 16 | cp sources.list nfs/etc/apt/sources.list |
| 17 | chroot nfs apt-get update |
Jesse Andrews | 8622bf2 | 2011-09-11 15:27:54 -0700 | [diff] [blame^] | 18 | 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 Andrews | ba23cc7 | 2011-09-11 03:22:13 -0700 | [diff] [blame] | 20 | 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 |
| 27 | fi |
| 28 | |
| 29 | cp -pr nfs $DEST |
| 30 | |
| 31 | # set hostname |
| 32 | echo $NAME > $DEST/etc/hostname |
| 33 | echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts |
| 34 | |
| 35 | # copy kernel modules |
| 36 | cp -pr /lib/modules/`uname -r` $DEST/lib/modules |
| 37 | |
| 38 | # copy openstack installer and requirement lists to a new directory. |
| 39 | mkdir -p $DEST/opt |
| 40 | cp stack.sh $DEST/opt/stack.sh |
| 41 | cp -r pips $DEST/opt |
| 42 | cp -r apts $DEST/opt |
| 43 | |
| 44 | # injecting root's ssh key |
| 45 | # FIXME: only do this if id_rsa.pub exists |
| 46 | mkdir $DEST/root/.ssh |
| 47 | chmod 700 $DEST/root/.ssh |
| 48 | cp /root/.ssh/id_rsa.pub $DEST/root/.ssh/authorized_keys |
| 49 | |
| 50 | # set root password to password |
| 51 | echo root:password | chroot $DEST chpasswd |
| 52 | |