drupal.sh 11.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
echo ""
echo "Running drupal.sh"
echo ""
## Call the variable file so we can fill in the bits
. /tmp/variable.sh

profiles='drupal7 drupal7alt drupal7os'
for profile in $profiles
  do
Chris Shantz's avatar
Chris Shantz committed
10
    drush dl -v -d drupal-7.56 --destination="/var/www" --drupal-project-rename="$profile"
11
12
done

13
14
drush dl -v -d drupal-8.4.0 --destination="/var/www" --drupal-project-rename="drupal8"
drush dl -v -d drupal-8.4.0 --destination="/var/www" --drupal-project-rename="drupal8alt"
Chris Shantz's avatar
Chris Shantz committed
15
16
drush dl -v -d drupal-7.56 --destination="/var/www" --drupal-project-rename="drupal7rel"
drush dl -v -d drupal-7.56 --destination="/var/www" --drupal-project-rename="drupal7lrel"
17
18

## Install our base profile
19
profiles='drupal7 drupal7alt drupal7rel drupal7lrel drupal8 drupal8alt'
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
for profile in $profiles
do
  cd /var/www/$profile/profiles
  git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git
done

#cd /var/www/drupal7/profiles
#git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git
#cd /var/www/drupal7alt/profiles
#git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git
#cd /var/www/drupal7rel/profiles
#git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git
#cd /var/www/drupal7lrel/profiles
#git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git
cd /var/www/drupal7os/profiles
git clone https://git.uwaterloo.ca/wcms/uw_base_profile.git
36
37
git clone https://git.uwaterloo.ca/wcms-openscholar/openscholar.git

38
39

cd /var/www/drupal7lrel/profiles/uw_base_profile
40
git checkout 7.x-1.13.3
41
42

cd /var/www/drupal7rel/profiles/uw_base_profile
43
git checkout 7.x-2.4.1
44

45
46
cd /var/www/drupal8/profiles/uw_base_profile
git checkout 8.x-3.x
47

48
49
50
cd /var/www/drupal8alt/profiles/uw_base_profile
git checkout 8.x-3.x

51
52
53
54
## Install the drush registry_rebuild module
drush @none dl registry_rebuild

## Create the config folder in drupal root and an empty password_settings file
55
mkdir /var/www/drupal7/config
56
57
touch /var/www/drupal7/config/password_settings.php

58
59
60
## Create an empty fonts folder so I know where it's supposed to go! ;)
mkdir /var/www/drupal7/fonts

61
profiles='drupal7alt drupal7rel drupal7lrel drupal7os drupal8 drupal8alt'
62
63
64
for profile in $profiles
do
  ln -s /var/www/drupal7/config /var/www/$profile/
65
  ln -s /var/www/drupal7/fonts /var/www/$profile/
66
  
67
68
69
done
## Create site folders for drupal multi-site
## Use string replace to get the "bit after drupal" to complete the sitename to reduce code.
70
echo 'Creating site directories......'
71
profiles='drupal7 drupal7alt drupal7rel drupal7lrel drupal7os drupal8 drupal8alt'
72
73
74
75
76
77
78
79
80
81
82
83
84

sites=5;
for profile in $profiles
do
   sitename="${profile/drupal/${vgrtserver}}"
   for site in `seq 1 $sites`
   do
    mkdir /var/www/$profile/sites/$sitename.${vgrtsite}$site
    mkdir /var/www/$profile/sites/$sitename.${vgrtsite}$site/files
    mkdir /var/www/$profile/sites/$sitename.${vgrtsite}$site/modules
    echo "$site"
   done
done
85
86
## Drupal 8 requires a sync folder to be created
echo 'Creating Drupal 8 sync directory......'
87
profiles='drupal8 drupal8alt'
88
89
90
sites=5;
for profile in $profiles
do
91
92
 sitename="${profile/drupal/${vgrtserver}}"
 ## Create the sites.php file for drupal8 with the fdsu sites defined otherwise the setting.php can't be found.
93
  echo "<?php
94
    \$sites = array(
95
96
97
98
99
        '$sitename.${vgrtsite}1' => '${vgrtsite}1',
        '$sitename.${vgrtsite}2' => '${vgrtsite}2',
        '$sitename.${vgrtsite}3' => '${vgrtsite}3',
        '$sitename.${vgrtsite}4' => '${vgrtsite}4',
        '$sitename.${vgrtsite}5' => '${vgrtsite}5',
100
101
102
103
104
105
106
107
108
109
110
      );" > /var/www/$profile/sites/sites.php
   echo "created $profile sites.php file."
   for site in `seq 1 $sites`
   do
    mkdir /var/www/$profile/sites/$sitename.${vgrtsite}$site/files/config_acqTmp
    mkdir /var/www/$profile/sites/$sitename.${vgrtsite}$site/files/config_acqTmp/sync
    echo "$site"
   done
done
echo "Create symlinks for multi-site"
## Create symlinks for multi-site
111
profiles='drupal7 drupal7alt drupal7rel drupal7lrel drupal7os drupal8 drupal8alt'
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
sites=5;
for profile in $profiles
do
  for site in `seq 1 $sites`
  do
    cd /var/www/$profile
    ln -s . ${vgrtsite}$site
  done
done

##Create settings.php files for each site
profiles='drupal7 drupal7alt drupal7rel drupal7lrel drupal7os'
sites=5;
for profile in $profiles
do
  sitename="${profile/drupal/${vgrtserver}}"
  server="${profile/drupal/d}"
  for site in `seq 1 $sites`
    do
echo "<?php
// Server domain name.
${VGUWHOST} = '$sitename';
// Path to site root.
${VGUWPREF} = '${vgrtsite}$site';
// Name of site database.
${VGUWDB} = '$server"_fdsu"$site';
// Username to connect to site database.
${VGUWUSER} = 'root';
// Password to connect to site database.
${VGUWPASS} = 'vagrant';
// Host name to connect to site database.
${VGUWPRI} = 'localhost';

// Path to \"global\" settings file. Do not edit.
require_once(DRUPAL_ROOT . '/profiles/uw_base_profile/drupal-settings.php');

// File system settings.
${VGUWCONF}['file_default_scheme'] = 'public';
${VGUWCONF}['file_private_path'] = 'sites/$sitename.${vgrtsite}$site/files/private/';
${VGUWCONF}['file_public_path'] = 'sites/$sitename.${vgrtsite}$site/files';
${VGUWCONF}['file_temporary_path'] = 'sites/$sitename.${vgrtsite}$site/files/temp/';
${VGUWCONF}['file_chmod_directory'] = 02775;
154
${VGUWCONF}['file_chmod_file'] = 0664;" > /var/www/$profile/sites/$sitename.${vgrtsite}$site/settings.php
155
156
157
    done
done

158
159
## Create the Drupal8 settings.php file. It's a bit different because we don't have a base profile yet! (Mar.2016)
sites=5;
160
profiles='drupal8 drupal8alt'
161
162
163
164
165
166
for profile in $profiles
do
  sitename="${profile/drupal/${vgrtserver}}"
  server="${profile/drupal/d}"
  for site in `seq 1 $sites`
   do
167
168
     ## Drupal 8 requires a salted hash in the settings.php file (if it's missing it rewrites the database settings to the file).
     salt_hash=$(echo $(date +%s) $site | sha256sum | base64 | head -c 74);
169
170
171
172
173
174
175
176
177
178
179
180
181
182
echo "<?php
// Server domain name.
${VGUWHOST} = '$sitename';
// Path to site root.
${VGUWPREF} = '${vgrtsite}$site';
// Name of site database.
${VGUWDB} = '$server"_fdsu"$site';
// Username to connect to site database.
${VGUWUSER} = 'root';
// Password to connect to site database.
${VGUWPASS} = 'vagrant';
// Host name to connect to site database.
${VGUWPRI} = 'localhost';

183
require_once(DRUPAL_ROOT . '/profiles/uw_base_profile/drupal-settings.php');
184
185

// File system settings.
186
187
188
189
190
191
192
193
194
${VGUWCONFD8}['file_default_scheme'] = 'public';
${VGUWCONFD8}['file_private_path'] = 'sites/$sitename.${vgrtsite}$site/files/private/';
${VGUWCONFD8}['file_public_path'] = 'sites/$sitename.${vgrtsite}$site/files';
${VGUWCONFD8}['file_temporary_path'] = 'sites/$sitename.${vgrtsite}$site/files/temp/';
${VGUWCONFD8}['file_chmod_directory'] = 02775;
${VGUWCONFD8}['file_chmod_file'] = 0664;

// D8 required settings.
${VGUWCONFD8}['hash_salt'] = '$salt_hash';
195
196
${VGUWCONFD8}['install_profile'] = 'uw_base_profile';
${VGUWCONFD8}['trusted_host_patterns'] = ['^$sitename\$',];
Chris Shantz's avatar
Chris Shantz committed
197
${VGUWCONFD8D}['sync'] = 'sites/$sitename.${vgrtsite}$site/files/config_acqTmp/sync';" > /var/www/$profile/sites/$sitename.${vgrtsite}$site/settings.php
198
199
200
cp /var/www/drupal8/sites/default/default.services.yml /var/www/$profile/sites/$sitename.${vgrtsite}$site/services.yml
  done
done
201
202
203
204
205
206
207
208
209
210
211
212
213
214

## Create a directory structure
chown -R vagrant:www-data /var/www
chmod -R g+w /var/www

## Run updatedb
sudo updatedb

## Restart Apache
service apache2 restart


## Create a database and grant a user some permissions
echo "Create databases and grant permissions..."
215
dbprefaces='d7 d7alt d7rel d7lrel d7os d8 d8alt'
216
217
218
219
220
221
222
223
224
225
226
227

sites=5;
echo "start..."
for dbpreface in $dbprefaces
do
  for site in `seq 1 $sites`
    do
    echo "Here are some variables $dbpreface"_fdsu"$site"
    echo "create database $dbpreface"_fdsu"$site;" | mysql -u root -p --password=vagrant
    echo "grant all on $dbpreface"_fdsu"$site.* to vagrant@localhost identified by 'vagrant';" | mysql -u root -p --password=vagrant
  done
done
228
229

sites=5;
230
profiles='drupal8 drupal8alt'
231
232
233
234
235
236
for profile in $profiles
do
  sitename="${profile/drupal/${vgrtserver}}"
  server="${profile/drupal/d}"
  for site in `seq 1 $sites`
   do
237
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
238

Chris Shantz's avatar
Chris Shantz committed
239
<!-- TODO set checkForUnintentionallyCoveredCode=\"true\" once https://www.drupal.org/node/2626832 is resolved. -->
240
241
242
243
<!-- PHPUnit expects functional tests to be run with either a privileged user
 or your current system user. See core/tests/README.md and
 https://www.drupal.org/node/2116263 for details.
-->
244
245
246
247
248
249
<phpunit bootstrap=\"../../core/tests/bootstrap.php\" colors=\"true\"
         beStrictAboutTestsThatDoNotTestAnything=\"true\"
         beStrictAboutOutputDuringTests=\"true\"
         beStrictAboutChangesToGlobalState=\"true\"
         checkForUnintentionallyCoveredCode=\"false\">
<!-- TODO set printerClass=\"\Drupal\Tests\Listeners\HtmlOutputPrinter\" once
250
251
252
253
 https://youtrack.jetbrains.com/issue/WI-24808 is resolved. Drupal provides a
 result printer that links to the html output results for functional tests.
 Unfortunately, this breaks the output of PHPStorm's PHPUnit runner. However, if
 using the command line you can add
254
 - -printer=\"\Drupal\Tests\Listeners\HtmlOutputPrinter\" to use it (note there
255
256
257
258
 should be no spaces between the hyphens).
-->
  <php>
    <!-- Set error reporting to E_ALL. -->
259
    <ini name=\"error_reporting\" value=\"32767\"/>
260
    <!-- Do not limit the amount of memory tests take to run. -->
261
    <ini name=\"memory_limit\" value=\"-1\"/>
262
    <!-- Example \"SIMPLETEST_BASE_URL\" value: http://localhost -->
263
    <env name=\"SIMPLETEST_BASE_URL\" value=\"https://$sitename/${vgrtsite}$site\"/>
264
265
    <!-- Example \"SIMPLETEST_DB\" value: mysql://username:password@localhost/databasename#table_prefix -->
    <env name=\"SIMPLETEST_DB\" value=\"mysql://root:vagrant@localhost/$sitename\_${vgrtsite}$site\"/>
266
    <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
267
    <env name=\"BROWSERTEST_OUTPUT_DIRECTORY\" value=\"\"/>
268
269
  </php>
  <testsuites>
270
    <testsuite name=\"unit\">
271
272
      <file>../../core/tests/TestSuites/UnitTestSuite.php</file>
    </testsuite>
273
    <testsuite name=\"kernel\">
274
275
      <file>../../core/TestSuites/KernelTestSuite.php</file>
    </testsuite>
276
    <testsuite name=\"functional\">
277
278
      <file>../../core/tests/TestSuites/FunctionalTestSuite.php</file>
    </testsuite>
279
    <testsuite name=\"functional-javascript\">
280
281
282
283
      <file>../../core/tests/TestSuites/FunctionalJavascriptTestSuite.php</file>
    </testsuite>
  </testsuites>
  <listeners>
284
    <listener class=\"\Drupal\Tests\Listeners\DrupalStandardsListener\">
285
286
287
288
289
290
291
292
293
294
295
296
    </listener>
  </listeners>
  <!-- Filter for coverage reports. -->
  <filter>
    <whitelist>
      <directory>../../core/includes</directory>
      <directory>../../core/lib</directory>
      <directory>../../core/modules</directory>
      <directory>../../../modules</directory>
      <directory>../../../sites</directory>
      <!-- By definition test classes have no tests. -->
      <exclude>
297
298
        <directory suffix=\"Test.php\">./</directory>
        <directory suffix=\"TestBase.php\">./</directory>
299
300
301
302
303
304
305
      </exclude>
     </whitelist>
  </filter>
</phpunit>
" > /var/www/$profile/sites/$sitename.${vgrtsite}$site/phpunit.xml.dist
  done
done
306
307

## Add the apps folder for Drupal 7 conference and publications themes.
308
profiles='drupal7 drupal7alt drupal7rel drupal7lrel'
309
310
311
312
for profile in $profiles
do
  mkdir /var/www/$profile/apps
done 
313