Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 184 lines (147 sloc) 5.63 KB
#!/bin/bash
################################################################################
#
# This script will setup a local copy of Drupal 7
# based on the Installation Profile.
#
# Do not change the content of this file,
# all configuration variables are in the config.sh file.
#
################################################################################
# Define the root of the GIT repository.
cd ${0%/*}
ROOT=$(pwd)
cd $ROOT
# Load the colors.
source $ROOT/scripts/helper-colors.sh
# Load the helpers.
source $ROOT/scripts/helper-functions.sh
# Load the configuration.
load_config_file
# Check config
check_config_file
##
# Function to explain the script arguments.
##
function arguments_usage {
USAGE=$(fill_string_spaces "Usage: $0 [options]" 61)
TITLE=$(fill_string_spaces "Install $PROFILE_TITLE" 61)
echo
echo -e "${BGCYAN} ${RESTORE}"
echo -e "${BGLCYAN} $TITLE ${RESTORE}"
echo -e "${BGCYAN} This will install the platform as defined in the config file. ${RESTORE}"
echo -e "${BGCYAN} If the platform is already installed, it will be removed and ${RESTORE}"
echo -e "${BGCYAN} reinstalled. ${RESTORE}"
echo -e "${BGCYAN} ${RESTORE}"
echo -e "${BGCYAN} $USAGE ${RESTORE}"
echo -e "${BGCYAN} ${RESTORE}"
echo -e "${BGCYAN} OPTIONS: ${RESTORE}"
echo -e "${BGCYAN} -h Show this message. ${RESTORE}"
echo -e "${BGCYAN} -d Load demo content after the installation. ${RESTORE}"
echo -e "${BGCYAN} -l Open a new tab in your default browser and login to ${RESTORE}"
echo -e "${BGCYAN} your project as the Administrator. ${RESTORE}"
echo -e "${BGCYAN} -y Answer automatically yes to the confirmation questions. ${RESTORE}"
echo -e "${BGCYAN} ${RESTORE}"
echo
}
# Check and process arguments.
# See http://rsalveti.wordpress.com/2007/04/03/bash-parsing-arguments-with-getopts/
while getopts "hdly" OPTION
do
case $OPTION in
h)
arguments_usage
exit 1
;;
d)
DEMO_CONTENT=1
;;
l)
AUTO_LOGIN=1
;;
y)
UNATTENDED=1
;;
?)
arguments_usage
exit
;;
esac
done
# Always ask confirmation before destroying the Database & Files!
TITLE=$(fill_string_spaces "Install $PROFILE_TITLE" 61)
INFO=$(fill_string_spaces "> This will install the $PROFILE_NAME profile." 61)
echo
echo -e "${BGBLUE} ${RESTORE}"
echo -e "${BGLBLUE} $TITLE ${RESTORE}"
echo -e "${BGBLUE} ${RESTORE}"
echo -e "${BGBLUE} > This will delete the database, contrib code and files. ${RESTORE}"
echo -e "${BGBLUE} > This will recreate the environment ${RESTORE}"
echo -e "${BGBLUE} (download Drupal + contrib modules & themes). ${RESTORE}"
echo -e "${BGBLUE} $INFO ${RESTORE}"
if [ $DEMO_CONTENT ] || [ $AUTO_LOGIN ]; then
echo -e "${BGBLUE} ${RESTORE}"
fi
if [ $DEMO_CONTENT ]; then
echo -e "${BGBLUE} • Demo content will be loaded into the platform. ${RESTORE}"
fi
if [ $AUTO_LOGIN ]; then
echo -e "${BGBLUE} • A browser tab will open and log you in as Administrator. ${RESTORE}"
fi
echo -e "${BGBLUE} ${RESTORE}"
echo
if [ ! $UNATTENDED ]; then
echo -e -n "${LRED}Are you sure?${RESTORE} (Y/n) "
read -e -n 1 -r
if [[ ! $REPLY =~ ^[Y|y]$ ]]; then
echo
echo -e "${BGYELLOW} ${RESTORE}"
echo -e "${BGLYELLOW} Installation aborted! ${RESTORE}"
echo -e "${BGYELLOW} ${RESTORE}"
echo
exit 0
fi
echo
fi
# Cleanup contrib modules, themes & libraries from the profile directory.
delete_profile_contrib
# Cleanup the sites/default content.
delete_sites_default_content
# Cleanup the www directory.
delete_www_content
# Run the build script (drush make + extra's).
drupal_make
# Symlink extra modules (if any).
symlink_externals
# Install the Drupal profile as defined in the config.sh file.
install_drupal_profile
# Composer install
composer_install
# Setup the files directory.
create_sites_default_files_directory
# Enable the development modules.
enable_development_modules
# Update settings.php.
update_settings
# Run post script (if any).
run_post_script "install"
# Load demo content if required.
if [ $DEMO_CONTENT ]; then
import_demo_content
fi
# Check if we have a working bootstrap.
check_drupal_bootstrap
# If we managed to get to here: the installation was successful!
LINK_INFO=$(fill_string_spaces "> Visit the site : ${BGLGREEN}$BASE_DOMAIN_URL${BGGREEN}" 89)
echo
echo -e "${BGGREEN} ${RESTORE}"
echo -e "${BGLGREEN} Installation complete! ${RESTORE}"
echo -e "${BGGREEN} $LINK_INFO ${RESTORE}"
echo -e "${BGGREEN} ${RESTORE}"
echo
# Auto Login?
if [ $AUTO_LOGIN ]; then
drupal_login
fi
# DONE!
exit 0
You can’t perform that action at this time.