X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=bin%2Fsetup.sh;h=b242dc4ae1e4767f5a35750e9e7883718ea72178;hb=b70035bab4234aef6ad7d8e738563e845f876859;hp=5261c2ee39ba299fedf1860cfe39ebb67252e40b;hpb=1219e6af26646ad548b2d7e97a7f345af4655c21;p=civicrm-core.git diff --git a/bin/setup.sh b/bin/setup.sh index 5261c2ee39..b242dc4ae1 100755 --- a/bin/setup.sh +++ b/bin/setup.sh @@ -23,12 +23,13 @@ if [ "$1" = '-h' ] || [ "$1" = '--help' ]; then echo echo "Usage: setup.sh [options] [schema file] [database data file] [database name] [database user] [database password] [database host] [database port] [additional args]" echo "[options] is a mix of zero or more of following:" - echo " -a (All) Implies -Dgsdf (default)" - echo " -D (Download) Download depdencies" - echo " -g (GenCode) Generate DAO files, SQL files, etc" - echo " -s (Schema) Load new schema in DB" - echo " -d (Data) Load default data in DB" - echo " -f (Flush) Flush caches and settings" + echo " -a (All) Implies -Dgsef (default)" + echo " -D (Download) Download dependencies" + echo " -g (GenCode) Generate DAO files, SQL files, etc" + echo " -s (Schema) Load new schema in DB" + echo " -d (Data-Plain) Load basic dataset in DB" + echo " -e (Data-Examples) Load example dataset in DB" + echo " -f (Flush) Flush caches and settings" echo echo "Example: Perform a full setup" echo " setup.sh -a" @@ -37,7 +38,7 @@ if [ "$1" = '-h' ] || [ "$1" = '--help' ]; then echo " setup.sh -Dg" echo echo "Example: Keep the existing code but reset the DB" - echo " setup.sh -sdf" + echo " setup.sh -sef" exit 0 fi @@ -50,8 +51,9 @@ DO_GENCODE= DO_SCHEMA= DO_DATA= DO_FLUSH= +DEFAULT_DATA= -while getopts "aDgsdf" opt; do +while getopts "aDgsdef" opt; do case $opt in a) DO_DOWNLOAD=1 @@ -75,6 +77,12 @@ while getopts "aDgsdf" opt; do ;; d) DO_DATA=1 + DEFAULT_DATA=civicrm_data.mysql + FOUND_ACTION=1 + ;; + e) + DO_DATA=1 + DEFAULT_DATA=civicrm_generated.mysql FOUND_ACTION=1 ;; f) @@ -97,6 +105,7 @@ if [ -z "$FOUND_ACTION" ]; then DO_SCHEMA=1 DO_DATA=1 DO_FLUSH=1 + DEFAULT_DATA=civicrm_generated.mysql fi shift $((OPTIND-1)) @@ -142,7 +151,24 @@ if [ -n "$DO_DOWNLOAD" ]; then fi BOWER=$(pickcmd node_modules/bower/bin/bower bower) - $BOWER install + if [ -f "$BOWER" ]; then + NODE=$(pickcmd node nodejs) + BOWER="$NODE $BOWER" + fi + # Without the force flag, bower may not check for new versions or verify that installed software matches version specified in bower.json + # With the force flag, bower will ignore all caches and download all deps. + if [ -n "$OFFLINE" ]; then + BOWER_OPT= + elif [ ! -f "bower_components/.setupsh.ts" ]; then + ## First run -- or cleanup from failed run + BOWER_OPT=-f + elif [ "bower.json" -nt "bower_components/.setupsh.ts" ]; then + ## Bower.json has changed since last run + BOWER_OPT=-f + fi + [ -f "bower_components/.setupsh.ts" ] && rm -f "bower_components/.setupsh.ts" + $BOWER install $BOWER_OPT + touch bower_components/.setupsh.ts popd fi @@ -180,10 +206,11 @@ fi if [ -n "$DO_DATA" ]; then pushd "$CALLEDPATH/../sql" - # load civicrm_generated.mysql sample data unless special DBLOAD is passed + # load default data set unless system is configured with override if [ -z $DBLOAD ]; then - echo; echo Populating database with example data - civicrm_generated.mysql - $MYSQLCMD < civicrm_generated.mysql + echo; + echo "Populating database with dataset - $DEFAULT_DATA" + $MYSQLCMD < "$DEFAULT_DATA" else echo; echo Populating database with required data - civicrm_data.mysql $MYSQLCMD < civicrm_data.mysql