[Lada-commits] [PATCH 1 of 4] Remove wrong test operator and prepare for more options
Wald Commits
scm-commit at wald.intevation.org
Fri May 6 12:26:13 CEST 2016
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1462529595 -7200
# Node ID f5d5cc08966ab19f2002a733210f72dd8e3b8748
# Parent 77ab533489669210a6993c2c28f6a9419fbcf3ab
Remove wrong test operator and prepare for more options.
diff -r 77ab53348966 -r f5d5cc08966a db_schema/setup-db.sh
--- a/db_schema/setup-db.sh Wed May 04 16:04:50 2016 +0200
+++ b/db_schema/setup-db.sh Fri May 06 12:13:15 2016 +0200
@@ -11,10 +11,15 @@
DIR=`dirname $0`
-if [ " $1" == " -c" ] ; then
- DROP_DB="true"
- shift
-fi
+while getopts "c" opt; do
+ case "$opt" in
+ c)
+ DROP_DB="true"
+ ;;
+ esac
+done
+
+shift $((OPTIND-1))
ROLE_NAME=${1:-lada}
echo "DROLE_NAME = $ROLE_NAME"
@@ -36,8 +41,8 @@
psql $DB_CONNECT_STRING --command "CREATE USER $ROLE_NAME PASSWORD '$ROLE_PW';"
fi
-if [ "$DROP_DB" == "true" ] && psql $DB_CONNECT_STRING -l | grep -q "^ $DB_NAME " ; then
- echo drop db $DB_NAME
+if [ "$DROP_DB" = "true" ] && psql $DB_CONNECT_STRING -l | grep -q "^ $DB_NAME " ; then
+ echo drop db $DB_NAME
psql $DB_CONNECT_STRING --command "DROP DATABASE $DB_NAME"
fi
More information about the Lada-commits
mailing list