indentation correction
[civicrm-core.git] / bin / setup.sh
index 0db06e1665e0d4547aa599b473ec91a15d5e8ec1..1d5435622e1d29069b3006dc18b7d40d4a3d9476 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+set -e
 
 CALLEDPATH=`dirname $0`
 
@@ -24,11 +25,11 @@ fi
 
 
 # fetch command line arguments if available
-if [ ! -z $1 ] ; then SCHEMA=$1; fi
-if [ ! -z $2 ] ; then DBLOAD=$2; fi
-if [ ! -z $3 ] ; then DBNAME=$3; fi
-if [ ! -z $4 ] ; then DBUSER=$4; fi
-if [ ! -z $5 ] ; then DBPASS=$5; fi
+if [ ! -z "$1" ] ; then SCHEMA="$1"; fi
+if [ ! -z "$2" ] ; then DBLOAD="$2"; fi
+if [ ! -z "$3" ] ; then DBNAME="$3"; fi
+if [ ! -z "$4" ] ; then DBUSER="$4"; fi
+if [ ! -z "$5" ] ; then DBPASS="$5"; fi
 
 # verify if we have at least DBNAME given
 if [ -z $DBNAME ] ; then
@@ -46,9 +47,9 @@ fi
 
 # run code generator if it's there - which means it's
 # checkout, not packaged code
-if [ -d $CALLEDPATH/../xml ]; then
-  cd $CALLEDPATH/../xml
-  "$PHP5PATH"php GenCode.php $SCHEMA
+if [ -d "$CALLEDPATH/../xml" ]; then
+  cd "$CALLEDPATH/../xml"
+  "$PHP5PATH"php GenCode.php $SCHEMA '' $GENCODE_CMS
 fi
 
 # someone might want to use empty password for development,
@@ -59,7 +60,7 @@ else
   PASSWDSECTION="-p$DBPASS"
 fi
 
-cd $CALLEDPATH/../sql
+cd "$CALLEDPATH/../sql"
 echo; echo "Dropping civicrm_* tables from database $DBNAME"
 # mysqladmin -f -u $DBUSER $PASSWDSECTION $DBARGS drop $DBNAME
 MYSQLCMD="mysql -u$DBUSER $PASSWDSECTION $DBARGS $DBNAME"
@@ -96,10 +97,10 @@ if [ ! -z $DBADD ]; then
 fi
 
 # run the cli script to build the menu and the triggers
-cd $CALLEDPATH/..
+cd "$CALLEDPATH/.."
 "$PHP5PATH"php bin/cli.php -e System -a flush --triggers 1 --session 1
 
-# reset config_backend and userFrameworkResourceURL which gets set 
+# reset config_backend and userFrameworkResourceURL which gets set
 # when config object is initialized
 mysql -u$DBUSER $PASSWDSECTION $DBARGS $DBNAME -e "UPDATE civicrm_domain SET config_backend = NULL; UPDATE civicrm_setting SET value = NULL WHERE name = 'userFrameworkResourceURL';"