Extract common functions into a separate file
This is the start of an effort to organize devstack's code
to better document the requirements for configuring the individual
components.
Change-Id: I3476b76b9d1f9ee63687fb9898a98729118cbd84
diff --git a/tools/build_ramdisk.sh b/tools/build_ramdisk.sh
index feaa8a9..7c1600b 100755
--- a/tools/build_ramdisk.sh
+++ b/tools/build_ramdisk.sh
@@ -47,7 +47,10 @@
# Keep track of the current directory
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=`cd $TOOLS_DIR/..; pwd`
+TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
+
+# Import common functions
+. $TOP_DIR/functions
# Store cwd
CWD=`pwd`
@@ -170,35 +173,6 @@
chroot $MNTDIR apt-get install -y linux-generic
fi
-# git clone only if directory doesn't exist already. Since ``DEST`` might not
-# be owned by the installation user, we create the directory and change the
-# ownership to the proper user.
-function git_clone {
-
- # clone new copy or fetch latest changes
- CHECKOUT=${MNTDIR}$2
- if [ ! -d $CHECKOUT ]; then
- mkdir -p $CHECKOUT
- git clone $1 $CHECKOUT
- else
- pushd $CHECKOUT
- git fetch
- popd
- fi
-
- # FIXME(ja): checkout specified version (should works for branches and tags)
-
- pushd $CHECKOUT
- # checkout the proper branch/tag
- git checkout $3
- # force our local version to be the same as the remote version
- git reset --hard origin/$3
- popd
-
- # give ownership to the stack user
- chroot $MNTDIR chown -R stack $2
-}
-
git_clone $NOVA_REPO $DEST/nova $NOVA_BRANCH
git_clone $GLANCE_REPO $DEST/glance $GLANCE_BRANCH
git_clone $KEYSTONE_REPO $DEST/keystone $KEYSTONE_BRANCH