[IMP] Launch script: help to use another configuration file to launch

multiple instance with different configuration of Gissmo
This commit is contained in:
Olivier DOSSMANN 2016-01-14 11:24:08 +01:00
parent d043040b91
commit 437bc2cdc3

View File

@ -15,17 +15,28 @@ POSTGRES_VERSION="9.5"
GISSMO_DOCKER_NAME="gissmo"
## User
CONFIG_FILENAME="config"
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 -z "$GISSMO_CFG"; then
# No Gissmo Launcher configuration file given. Search one.
CONFIG_FILENAME="config"
# first in XDG directory, otherwise ~/.config one.
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
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!"
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
fi
fi
else
# Gissmo Launcher configuration file is given! Check it.
CONFIG_FILE=$GISSMO_CFG
if ! test -f $CONFIG_FILE; then
echo "Configuration file not found: ${CONFIG_FILE}"
exit 1
fi
fi
@ -89,6 +100,10 @@ show_help() {
echo -e " $PROGRAM stop"
echo -e " $PROGRAM start python manage.py shell"
echo -e " $PROGRAM stop"
echo ""
echo -e "If GISSMO_CFG used, you can specify another configuration file. Example:"
echo ""
echo -e " GISSMO_CFG=~/new_config $PROGRAM"
# TODO: Add clean() command to STOP and DELETE Gissmo Docker container
# TODO: Add clean_db() command to STOP and DELETE postgreSQL Docker container
# TODO: Add clean_all() command that makes clean() and clean_db()