[IMP] Launch script: read configuration from current directory or

XDG_CONFIG_HOME one.
This commit is contained in:
Olivier DOSSMANN 2016-01-13 10:50:56 +01:00
parent 73eb353758
commit 8690b2897c

View File

@ -15,11 +15,21 @@ POSTGRES_VERSION="9.5"
GISSMO_DOCKER_NAME="gissmo" GISSMO_DOCKER_NAME="gissmo"
## User ## User
if ! test -f config; then CONFIG_FILENAME="config"
echo "'config' file not found. Copy config.example to config one and try again!" if test -z $XDG_CONFIG_HOME; then
CONFIG_DEFAULT_DIR="${HOME}/.config/gissmo"
else
CONFIG_DEFAULT_DIR="${XDG_CONFIG_HOME}"
fi
CONFIG_FILE="${CONFIG_DEFAULT_DIR}/${CONFIG_FILENAME}"
if ! test -f ${CONFIG_FILE}; then
CONFIG_FILE="${PWD}/${CONFIG_FILENAME}"
if ! test -f ${CONFIG_FILE}; then
echo "'config' file not found. Use 'config.example' file and copy it to 'config' one either in ${CONFIG_DEFAULT_DIR} or ${PWD}. Then try again!"
exit 1 exit 1
fi fi
. config || exit 1 fi
. ${CONFIG_FILE} || exit 1
## Composed ## Composed
GISSMO_DIR="${PROJECT_DIR}/${GIT_DIR_NAME}" GISSMO_DIR="${PROJECT_DIR}/${GIT_DIR_NAME}"