blob: 0f0d77ef66a26ffad084b5844d54206f573c949e [file] [log] [blame]
Matthew Treinish90ac9142014-03-17 14:58:37 +00001#!/usr/bin/env bash
2
3PROJECT_NAME=${PROJECT_NAME:-tempest}
4CFGFILE_NAME=${PROJECT_NAME}.conf.sample
5
6if [ -e etc/${PROJECT_NAME}/${CFGFILE_NAME} ]; then
7 CFGFILE=etc/${PROJECT_NAME}/${CFGFILE_NAME}
8elif [ -e etc/${CFGFILE_NAME} ]; then
9 CFGFILE=etc/${CFGFILE_NAME}
10else
11 echo "${0##*/}: can not find config file"
12 exit 1
13fi
14
15TEMPDIR=`mktemp -d /tmp/${PROJECT_NAME}.XXXXXX`
16trap "rm -rf $TEMPDIR" EXIT
17
18tools/config/generate_sample.sh -b ./ -p ${PROJECT_NAME} -o ${TEMPDIR}
Matthew Treinish42516852014-06-19 10:51:29 -040019if [ $? != 0 ]
20then
21 exit 1
22fi
Matthew Treinish90ac9142014-03-17 14:58:37 +000023
24if ! diff -u ${TEMPDIR}/${CFGFILE_NAME} ${CFGFILE}
Matthew Treinish3d468112013-10-24 21:49:14 +000025then
Matthew Treinish90ac9142014-03-17 14:58:37 +000026 echo "${0##*/}: ${PROJECT_NAME}.conf.sample is not up to date."
27 echo "${0##*/}: Please run ${0%%${0##*/}}generate_sample.sh."
28 exit 1
Matthew Treinish3d468112013-10-24 21:49:14 +000029fi