diff --git a/etc/boto.cfg b/etc/heat/boto.cfg similarity index 100% rename from etc/boto.cfg rename to etc/heat/boto.cfg diff --git a/etc/heat-api-cfn-paste.ini b/etc/heat/heat-api-cfn-paste.ini similarity index 100% rename from etc/heat-api-cfn-paste.ini rename to etc/heat/heat-api-cfn-paste.ini diff --git a/etc/heat-api-cfn.conf b/etc/heat/heat-api-cfn.conf similarity index 100% rename from etc/heat-api-cfn.conf rename to etc/heat/heat-api-cfn.conf diff --git a/etc/heat-api-cloudwatch-paste.ini b/etc/heat/heat-api-cloudwatch-paste.ini similarity index 100% rename from etc/heat-api-cloudwatch-paste.ini rename to etc/heat/heat-api-cloudwatch-paste.ini diff --git a/etc/heat-api-cloudwatch.conf b/etc/heat/heat-api-cloudwatch.conf similarity index 100% rename from etc/heat-api-cloudwatch.conf rename to etc/heat/heat-api-cloudwatch.conf diff --git a/etc/heat-engine.conf b/etc/heat/heat-engine.conf similarity index 100% rename from etc/heat-engine.conf rename to etc/heat/heat-engine.conf diff --git a/etc/heat-metadata-paste.ini b/etc/heat/heat-metadata-paste.ini similarity index 100% rename from etc/heat-metadata-paste.ini rename to etc/heat/heat-metadata-paste.ini diff --git a/etc/heat-metadata.conf b/etc/heat/heat-metadata.conf similarity index 100% rename from etc/heat-metadata.conf rename to etc/heat/heat-metadata.conf diff --git a/install.sh b/install.sh index 271d370d87..cf8aac9380 100755 --- a/install.sh +++ b/install.sh @@ -5,41 +5,55 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -CONF_DIR=/etc/heat +# Install prefix for config files (e.g. "/usr/local"). +# Leave empty to install into /etc +CONF_PREFIX="" LOG_DIR=/var/log/heat -mkdir -p $LOG_DIR -mkdir -p $CONF_DIR -pushd etc > /dev/null +install -d $LOG_DIR + + +archive_file() { + local f=$1 + + if [ -e $CONF_PREFIX/$f ]; then + echo "Archiving configuration file $CONF_PREFIX/$f" >&2 + mv $CONF_PREFIX/$f $CONF_PREFIX/$f.bak + fi +} # Archive existing heat-api* config files in preparation # for change to heat-api-cfn*, and future use of heat-api* -# the OpenStack API -for ext in '.conf' '-paste.ini'; do - heat_api_file="${CONF_DIR}/heat-api${ext}" - if [ -e ${heat_api_file} ]; then - echo "archiving configuration file ${heat_api_file}" - mv $heat_api_file ${heat_api_file}.bak - fi -done +# for the OpenStack API. +archive_file etc/heat/heat-api.conf +archive_file etc/heat/heat-api-paste.ini + + +install_dir() { + local dir=$1 + local prefix=$2 + + for fn in $(ls $dir); do + f=$dir/$fn + if [ -d $f ]; then + [ -d $prefix/$f ] || install -d $prefix/$f + install_dir $f $prefix + elif [ -f $prefix/$f ]; then + echo "NOT replacing existing config file $prefix/$f" >&2 + diff -u $prefix/$f $f + elif [ $fn = 'heat-engine.conf' ]; then + cat $f | sed s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e '/1 "%02x"' /dev/random`/ > $prefix/$f + else + + echo "Installing $fn in $prefix/$dir" >&2 + install -m 664 $f $prefix/$dir + fi + done +} + +install_dir etc $CONF_PREFIX -for f in * -do - if [ -d $f ]; then - # ignore directories - continue - elif [ -f $CONF_DIR/$f ]; then - echo "not copying over $CONF_DIR/$f" - diff -u $CONF_DIR/$f $f - elif [ $f = 'heat-engine.conf' ]; then - cat $f | sed s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e '/1 "%02x"' /dev/random`/ > $CONF_DIR/$f - else - cp $f $CONF_DIR - fi -done -popd > /dev/null ./setup.py install >/dev/null rm -rf build heat.egg-info -