-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-site.sh
executable file
·161 lines (137 loc) · 4.12 KB
/
build-site.sh
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
#!/bin/bash
# This script will install a Drupal site.
##############
# User Input #
##############
scriptdir='/Users/cjwest/Documents/htdocs/scripts/'
docroot='/Users/cjwest/Documents/htdocs/'
configfilesdir=${scriptdir}'configfiles/'
makefilesdir=${scriptdir}'makefiles/'
profile='standard'
drupalversion=7
debug=0
si_options=''
echo " \"1\" for dash-7.dev"
echo " \"2\" for dash.dev"
echo " \"3\" for jsa.dev"
echo " \"4\" for drupal-7.dev"
echo " \"5\" for soe-jsa "
echo " \"6\" for dash-7-2.dev"
echo " \"7\" for lm.dev"
echo " \"8\" for jsa.test"
echo " \"9\" for jse.dev"
echo " \"10\" for jse.test"
read -p "Which is the lucky site? " sitenumber
echo " \"r\" Rebuild your entire site? "
echo " \"m\" Just make your site? "
echo " \"i\" Just do a site install? "
read -p "What would you like to do? " task
if test $sitenumber = 1; then
sitename='dash-7.dev'
makefile=${makefilesdir}${sitename}.make
elif test $sitenumber = 2; then
sitename='dash.dev'
drupalversion=8
makefile=${makefilesdir}${sitename}.make
elif test $sitenumber = 3; then
sitename='jsa.dev'
makefile='/Users/cjwest/Documents/htdocs/stanford-jumpstart-deployer/make/development/jumpstart-academic.make'
profile='stanford_sites_jumpstart_academic'
si_options='install_configure_form.org_type="group" install_configure_form.enable_webauth=1'
elif test $sitenumber = 4; then
sitename='drupal-7.dev'
makefile=${makefilesdir}${sitename}.make
elif test $sitenumber = 5; then
sitename='soe-jsa'
makefile=''
elif test $sitenumber = 6; then
sitename='dash-7-2.dev'
makefile=${makefilesdir}${sitename}.make
elif test $sitenumber = 7; then
sitename='lm.dev'
makefile=${makefilesdir}${sitename}.make
else
echo 'Error: invalid site selection'
exit 0
fi
sitealias='@local.'${sitename}
configfile=${configfilesdir}${sitename}'.sh'
echo Here is what we\'re building with:
echo sitename: $sitename
echo sitealias: $sitealias
echo makefile: $makefile
echo profile: $profile
echo configfile: $configfile
echo scriptdir: $scriptdir
echo docroot: $docroot
echo drupalversion: $drupalversion
echo si_options: $si_options
echo debug: $debug
echo task: $task
read -p "Okay to proceed? (y/n) " proceed
if test $proceed = y; then
echo 'Okay, proceeding....'
echo 'Start time: '
date
else
echo 'Aborting build, bye'
exit 0
fi
# Delete the directory
if [ $debug -eq 0 ] ; then
if [ $task == 'r' -o $task == 'm' ] ; then
if [ -d ${docroot}${sitename} ] ; then
echo removing ${docroot}${sitename} directory
chmod -R 777 ${docroot}${sitename}
rm -Rf ${docroot}${sitename}
fi
fi
fi
if [ $debug -eq 1 ] ; then
if [ $task -ne 1 ] ; then
if [ -a ${makefile} ] ; then
echo Making: ${makefile}
chmod 777 /Users/cjwest/.drush/cache/default
sudo -u cjwest drush make ${makefile} ${docroot}${sitename} --force-complete --working-copy --concurrency=4 --prepare-install
elif [ -z ${makefile} ] ; then
echo "Thar\'s nothing to make. I hope you have all yer files!"
else
echo Error: makefile not found: ${makefile}
exit 0
fi
fi
fi
if [ $debug -eq 1 ] ; then
if [ $task -eq 1 ] ; then
echo Installing ${sitealias}
chmod 777 ${docroot}${sitename}/sites/default
echo sudo -u cjwest drush $sitealias si ${profile} --site-name='Local '${sitename} install_configure_form.tmpdir="sites/default/files/tmp" --account-name="admin" --account-pass="admin" --account-mail="[email protected]" ${si_options} -y
fi
fi
# Config
if [ $debug -eq 1 ] ; then
echo Configuring site ${sitealias}
if [ -x ${configfile} ] ; then
exec ${configfile}
fi
drush $sitealias en devel -y
drush $sitealias en coder -y
drush $sitealias en context_list_active -y
drush $sitealias vset stanford_sites_allow_features_generate TRUE
drush $sitealias upwd admin --password=admin
drush $sitealias fra --force -y
fi
echo Clearing cache ${sitealias}
if test $drupalversion = 7; then
drush $sitealias cc all
elif test $drupalversion = 8; then
drush $sitealias cache rebuild
fi
chmod 777 /Users/cjwest/.drush/cache/default
drush $sitealias uli
# Dinnertime!
echo 'Stop time: '
date
#echo -e "\a"
#echo -e "\a"
#echo -e "\a"