deb-mistral/tools/config/check_uptodate.sh
Christian Berendt c06f8e7bec Use $(COMMAND) instead of COMMAND
The usage of $(COMMAND) shoud be preferred. Details can be
found at http://mywiki.wooledge.org/BashFAQ/082.

Also replaced two ` used in strings with '.

Change-Id: Ia729470c58da6fe2e505426bd5ce93214ec1f655
2014-09-30 15:17:04 +02:00

26 lines
688 B
Bash
Executable File

#!/usr/bin/env bash
PROJECT_NAME=${PROJECT_NAME:-mistral}
CFGFILE_NAME=${PROJECT_NAME}.conf.sample
if [ -e etc/${PROJECT_NAME}/${CFGFILE_NAME} ]; then
CFGFILE=etc/${PROJECT_NAME}/${CFGFILE_NAME}
elif [ -e etc/${CFGFILE_NAME} ]; then
CFGFILE=etc/${CFGFILE_NAME}
else
echo "${0##*/}: can not find config file"
exit 1
fi
TEMPDIR=$(mktemp -d /tmp/${PROJECT_NAME}.XXXXXX)
trap "rm -rf $TEMPDIR" EXIT
tools/config/generate_sample.sh -b ./ -p ${PROJECT_NAME} -o ${TEMPDIR}
if ! diff -u ${TEMPDIR}/${CFGFILE_NAME} ${CFGFILE}
then
echo "${0##*/}: ${PROJECT_NAME}.conf.sample is not up to date."
echo "${0##*/}: Please run ${0%%${0##*/}}generate_sample.sh."
exit 1
fi