grenade/prep-base

52 lines
1.3 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 [[ ! -r $BASE_DEVSTACK_DIR/localrc ]]; then
sed -e "
s|\@BASE_RELEASE_DIR\@|$BASE_RELEASE_DIR|
s|\@DATA_DIR@|$DATA_DIR|
" $GRENADE_DIR/devstack.localrc.base >$BASE_DEVSTACK_DIR/localrc
if [[ -r $GRENADE_DIR/devstack.localrc ]]; then
cat $GRENADE_DIR/devstack.localrc >>$BASE_DEVSTACK_DIR/localrc
fi
fi