#!/bin/bash set -e # Set the directory in which Drupal should be downloaded for the test. DRUPAL_ROOT=${1:-'d8-2461341'} # Fails with standard profile, works with minimal. PROFILE=${PROFILE:-'standard'} # Set a custom drush command via DRUSH env var. DRUSH=${DRUSH:-'drush'} # Set DB credentials via these env vars. DB_DRIVER=${DB_DRIVER:-'mysql'} DB_HOST=${DB_HOST:-'127.0.0.1'} DB_USERNAME=${DB_USERNAME:-'root'} DB_PASSWORD=${DB_PASSWORD:-'password'} DB_NAME=${DB_NAME:-'d8_2461341'} if ! command -v "$DRUSH" > /dev/null; then echo "Drush not found" exit 1 fi if [ ! -d $DRUPAL_ROOT ]; then git clone --branch 8.0.x http://git.drupal.org/project/drupal.git $DRUPAL_ROOT fi cd $DRUPAL_ROOT # Ensure this is a fresh copy of Drupal 8. chmod -R u+w sites/default || true git reset --hard origin/8.0.x git clean -xdf # Pre-create the config directories. mkdir -p config/active mkdir -p config/staging # Create a read-only custom settings.php. Drupal should not need to write to # this file during installation. cat > sites/default/settings.php << EOF 'config/active', CONFIG_STAGING_DIRECTORY => 'config/active', ); \$databases['default']['default'] = array( 'driver' => '${DB_DRIVER}', 'host' => '${DB_HOST}', 'username' => '${DB_USERNAME}', 'password' => '${DB_PASSWORD}', 'database' => '${DB_NAME}', 'prefix' => '', ); EOF chmod 0444 sites/default/settings.php # Empty the database prior to the install. $DRUSH -y -q sql-drop || true # Install the site. $DRUSH -y si $PROFILE