grenade/prep-base
Dean Troyer 185e57abe1 Combine localrc files
Use the Grenade devstack.localrc.* files as the 'default' for DevStack
by pre-pending them to the devstack-vm-gate.sh generated localrc.

devstack.localrc is now appended to the combined DevStack localrc
to still allow it to be the final config.  Normally this will be empty.

Change-Id: I18cb963c4baeeeb447bcb1436521100f1372882a
2013-04-05 10:45:28 -05:00

66 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# ``prep-base`` handles the preparations for installing and configuring
# the "base" configuration of DevStack.
# Keep track of the devstack directory
GRENADE_DIR=$(cd $(dirname "$0") && pwd)
# Import common functions
source $GRENADE_DIR/functions
# Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
# and ``DISTRO``
GetDistro
# Source params
source $GRENADE_DIR/grenaderc
# For debugging
set -o xtrace
# System Preparation
# ==================
# perform cleanup to ensure a clean starting environment
##add a config opt to still do this?
##rm -rf $BASE_DEVSTACK_DIR
# Get DevStack if it doesn't exist
if [[ ! -d $BASE_DEVSTACK_DIR ]]; then
git_clone $BASE_DEVSTACK_REPO $BASE_DEVSTACK_DIR $BASE_DEVSTACK_BRANCH
fi
# Load up a copy of the downloaded images if not present
if [[ -d ${STACK_ROOT}/images ]]; then
rsync -a ${STACK_ROOT}/images/* $BASE_DEVSTACK_DIR/files
fi
# Set up base localrc
# if localrc exists and localrc.orig does not exist, save localrc to localrc.orig
if [[ -r $BASE_DEVSTACK_DIR/localrc && ! -r $BASE_DEVSTACK_DIR/localrc.orig ]]; then
mv $BASE_DEVSTACK_DIR/localrc $BASE_DEVSTACK_DIR/localrc.orig
fi
# put devstack.localrc.target in place as localrc
sed -e "
s|\@BASE_RELEASE_DIR\@|$BASE_RELEASE_DIR|
s|\@DATA_DIR@|$DATA_DIR|
" $GRENADE_DIR/devstack.localrc.base >$BASE_DEVSTACK_DIR/localrc
# if localrc.orig exists, append it to localrc
if [[ -r $BASE_DEVSTACK_DIR/localrc.orig ]]; then
echo "#vvvvvvvvvv devstack-vm-gate.sh localrc vvvvvvvvvv" >>$BASE_DEVSTACK_DIR/localrc
cat $BASE_DEVSTACK_DIR/localrc.orig >>$BASE_DEVSTACK_DIR/localrc
fi
# if devstack.localrc exists append it to locarc
if [[ -r $GRENADE_DIR/devstack.localrc ]]; then
echo "#vvvvvvvvvv devstack.localrc vvvvvvvvvv" >>$BASE_DEVSTACK_DIR/localrc
cat $GRENADE_DIR/devstack.localrc >>$BASE_DEVSTACK_DIR/localrc
fi