Browse code

Copy devstack into image

Dean Troyer authored on 2011/10/03 23:56:41
Showing 2 changed files
... ...
@@ -6,10 +6,12 @@ CHROOTCACHE=${CHROOTCACHE:-/root/cache}
6 6
 # Source params
7 7
 source ./stackrc
8 8
 
9
-# TODO: make dest not hardcoded
9
+# Store cwd
10
+CWD=`pwd`
10 11
 
11 12
 NAME=$1
12
-DEST="/nfs/$NAME"
13
+NFSDIR="/nfs/$NAME"
14
+DEST=${DEST:-/opt/stack}
13 15
 
14 16
 # remove old nfs filesystem if one exists
15 17
 rm -rf $DEST
... ...
@@ -92,26 +94,21 @@ git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH
92 92
 chroot $CHROOTCACHE/natty-stack mkdir -p $DEST/files
93 93
 wget -c http://images.ansolabs.com/tty.tgz -O $CHROOTCACHE/natty-stack$DEST/files/tty.tgz
94 94
 
95
-cp -pr $CHROOTCACHE/natty-stack $DEST
96
-
97
-# set hostname
98
-echo $NAME > $DEST/etc/hostname
99
-echo "127.0.0.1 localhost $NAME" > $DEST/etc/hosts
100
-
101
-# copy kernel modules
102
-cp -pr /lib/modules/`uname -r` $DEST/lib/modules
103
-
95
+# Use this version of devstack?
96
+if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
97
+    rm -rf $$CHROOTCACHE/natty-stack/$DEST/devstack
98
+    cp -pr $CWD $CHROOTCACHE/natty-stack/$DEST/devstack
99
+fi
104 100
 
105
-# copy openstack installer and requirement lists to a new directory.
106
-mkdir -p $DEST/opt
101
+cp -pr $CHROOTCACHE/natty-stack $NFSDIR
107 102
 
108
-# inject stack.sh and dependant files
109
-cp -r files $DEST/opt/files
110
-cp stack.sh $DEST/opt/stack.sh
103
+# set hostname
104
+echo $NAME > $NFSDIR/etc/hostname
105
+echo "127.0.0.1 localhost $NAME" > $NFSDIR/etc/hosts
111 106
 
112 107
 # injecting root's public ssh key if it exists
113 108
 if [ -f /root/.ssh/id_rsa.pub ]; then
114
-    mkdir $DEST/root/.ssh
115
-    chmod 700 $DEST/root/.ssh
116
-    cp /root/.ssh/id_rsa.pub $DEST/root/.ssh/authorized_keys
109
+    mkdir $NFSDIR/root/.ssh
110
+    chmod 700 $NFSDIR/root/.ssh
111
+    cp /root/.ssh/id_rsa.pub $NFSDIR/root/.ssh/authorized_keys
117 112
 fi
... ...
@@ -12,6 +12,9 @@ CHROOTCACHE=${CHROOTCACHE:-/root/cache}
12 12
 # Source params
13 13
 source ./stackrc
14 14
 
15
+# Store cwd
16
+CWD=`pwd`
17
+
15 18
 DEST=${DEST:-/opt/stack}
16 19
 
17 20
 # clean install of natty
... ...
@@ -89,6 +92,12 @@ git_clone $DASH_REPO $DEST/dash $DASH_BRANCH
89 89
 git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH
90 90
 git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH
91 91
 
92
+# Use this version of devstack?
93
+if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then
94
+    rm -rf $CACHEDIR/$DEST/devstack
95
+    cp -pr $CWD $CACHEDIR/$DEST/devstack
96
+fi
97
+
92 98
 # build a new image
93 99
 BASE=build.$$
94 100
 IMG=$BASE.img