Matthew Treinish | 90ac914 | 2014-03-17 14:58:37 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | PROJECT_NAME=${PROJECT_NAME:-tempest} |
| 4 | CFGFILE_NAME=${PROJECT_NAME}.conf.sample |
| 5 | |
| 6 | if [ -e etc/${PROJECT_NAME}/${CFGFILE_NAME} ]; then |
| 7 | CFGFILE=etc/${PROJECT_NAME}/${CFGFILE_NAME} |
| 8 | elif [ -e etc/${CFGFILE_NAME} ]; then |
| 9 | CFGFILE=etc/${CFGFILE_NAME} |
| 10 | else |
| 11 | echo "${0##*/}: can not find config file" |
| 12 | exit 1 |
| 13 | fi |
| 14 | |
| 15 | TEMPDIR=`mktemp -d /tmp/${PROJECT_NAME}.XXXXXX` |
| 16 | trap "rm -rf $TEMPDIR" EXIT |
| 17 | |
| 18 | tools/config/generate_sample.sh -b ./ -p ${PROJECT_NAME} -o ${TEMPDIR} |
| 19 | |
| 20 | if ! diff -u ${TEMPDIR}/${CFGFILE_NAME} ${CFGFILE} |
Matthew Treinish | 3d46811 | 2013-10-24 21:49:14 +0000 | [diff] [blame] | 21 | then |
Matthew Treinish | 90ac914 | 2014-03-17 14:58:37 +0000 | [diff] [blame] | 22 | echo "${0##*/}: ${PROJECT_NAME}.conf.sample is not up to date." |
| 23 | echo "${0##*/}: Please run ${0%%${0##*/}}generate_sample.sh." |
| 24 | exit 1 |
Matthew Treinish | 3d46811 | 2013-10-24 21:49:14 +0000 | [diff] [blame] | 25 | fi |