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

multiple instance with different configuration of Gissmo
master
Olivier DOSSMANN 2016-01-14 11:24:08 +01:00
parent d043040b91
commit 437bc2cdc3
1 changed files with 25 additions and 10 deletions

View File

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