This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·188 lines (154 loc) · 6.07 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/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]$ ]]; 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
# Setup the files directory.
create_sites_default_files_directory
# Enable the development modules.
enable_development_modules
# Load demo content if required.
if [ $DEMO_CONTENT ]; then
import_demo_content
fi
# Run post script (if any).
run_post_script "install"
# Check if we have a working bootstrap.
cd $ROOT/www
BOOTSTRAP_SUCCESS=`drush status grep "Drupal bootstrap" | grep "Successful"`
cd $ROOT
if [ ! "$BOOTSTRAP_SUCCESS" ]; then
echo
echo -e "${BGRED} ${RESTORE}"
echo -e "${BGLRED} Installation failure! ${RESTORE}"
echo -e "${BGRED} > Drupal Bootstrap could not complete successfully. ${RESTORE}"
echo -e "${BGRED} ${RESTORE}"
echo
exit 1
fi
# 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