11#! /bin/bash
2- sleep 10
2+ date +" @ %Y-%m-%d %H:%M:%S %z"
3+
4+ # wait for mysql start
35while ! pgrep -u mysql mysqld > /dev/null; do sleep 3; done
6+ sleep 10
47
58REPOSDIR=` pwd`
69if [ ! -f $REPOSDIR /civicrm-version.txt ]; then
@@ -20,17 +23,31 @@ export DRUPAL=7
2023date +" @ %Y-%m-%d %H:%M:%S %z"
2124echo " CI for Drupal-$DRUPAL + netiCRM"
2225
23- EXISTSDB=` mysql -uroot -e " SHOW DATABASES" | grep neticrmci | wc -l`
24- if [ " $EXISTSDB " = " 0" ]; then
26+ # correct drush installation
27+ # # update composer
28+ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
29+ composer global remove drush/drush
30+ composer global require drush/drush:8.5.0 --no-security-blocking --no-audit
31+
32+ # init mysql
33+ DB_TEST=` mysql -uroot -sN -e " SHOW databases" `
34+ MYSQL_ACCESS=$?
35+ DB_EXISTS=` mysql -uroot -sN -e " SHOW databases" | grep $DB `
36+
37+ if [ $MYSQL_ACCESS -eq 0 ] && [ -z " $DB_EXISTS " ] && [ -n " $DB " ]; then
2538 echo " Install new database $DB "
2639 mysql -uroot -e " CREATE DATABASE $DB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
40+ echo " MySQL initialize completed !!"
41+ echo " MYSQL_DB=$DB "
42+ else
43+ echo " Skip exist $DB , database already setup before."
2744fi
2845
2946cd $DRUPAL_ROOT
3047
3148if [ ! -f $DRUPAL_ROOT /sites/default/settings.php ]; then
32- echo " Install Drupal ..."
3349 date +" @ %Y-%m-%d %H:%M:%S %z"
50+ echo " Install Drupal ..."
3451 sleep 5s
3552 php ~ /.composer/vendor/bin/drush.php --yes site-install standard --account-name=admin --db-url=mysql://root:@localhost/$DB --account-pass=$PW --site-name=netiCRM
3653
7491
7592# testing...
7693echo " Running test..."
94+ date +" @ %Y-%m-%d %H:%M:%S %z"
7795
0 commit comments