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