-
Notifications
You must be signed in to change notification settings - Fork 0
/
makesite.sh
executable file
·125 lines (109 loc) · 3.93 KB
/
makesite.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
#!/bin/bash
# This script will install a Drupal site.
##############
# User Input #
##############
scriptdir='/Users/cjwest/Documents/htdocs/drupal-scripts/'
docroot='/Users/cjwest/Documents/htdocs/'
configfilesdir=${scriptdir}'configfiles/'
profile='standard'
drupalversion=7
debug=0
si_options=''
task='all'
sitename=$1
sitealias='@local.'${sitename}
sitedir=${docroot}${sitename}/
makefiledir=${scriptdir}'makefiles/'
if [ "$sitename" == "" ] ; then
echo Houston, we have no site to build.
exit 0
# JSA
elif [ "$sitename" == "jsa.prod" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/production/jumpstart-academic.make'
elif [ "$sitename" == "jsa.test" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart-academic.make'
elif [ "$sitename" == "jsa.dev" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart-academic.make'
# JSE
elif [ "$sitename" == "jse.prod" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/production/jumpstart-engineering.make'
elif [ "$sitename" == "jse.test" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart-engineering.make'
elif [ "$sitename" == "jse.dev" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart-engineering.make'
# JSV
elif [ "$sitename" == "jsv.prod" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/production/jumpstart.make'
database='jsv_prod'
elif [ "$sitename" == "jsv.test" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart.make'
database='jsv_test'
elif [ "$sitename" == "jsv.dev" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart.make'
database='jsv_dev'
# JSP
elif [ "$sitename" == "jsp.prod" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/production/jumpstart_plus.make'
database='jsp_prod'
elif [ "$sitename" == "jsp.test" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart_plus.make'
database='jsp_test'
elif [ "$sitename" == "jsp.dev" ] ; then
makefile=${docroot}'stanford-jumpstart-deployer/make/development/jumpstart_plus.make'
database='jsp_dev'
# dash-7
elif [ "$sitename" == "dash-7.prod" ] ; then
makefile=${makefiledir}'dash-7.prod.make'
elif [ "$sitename" == "dash-7.test" ] ; then
makefile=${makefiledir}'dash-7.make'
elif [ "$sitename" == "dash-7.dev" ] ; then
makefile=${makefiledir}'dash-7.make'
# drupal-7
elif [ "$sitename" == "drupal-7.prod" ] ; then
makefile=${makefiledir}'drupal-7.prod.make'
elif [ "$sitename" == "drupal-7.test" ] ; then
makefile=${makefiledir}'drupal-7.test.make'
elif [ "$sitename" == "drupal-7.dev" ] ; then
makefile=${makefiledir}'drupal-7.dev.make'
else
echo Hmm, we don\'t have your site here: $sitename
exit 0
fi
sitealias='@local.'${sitename}
configfile=${configfilesdir}${sitename}'.sh'
sitedir=${docroot}${sitename}'/'
echo Here is what we\'re building with:
echo sitename: $sitename
echo sitealias: $sitealias
echo sitedir: $sitedir
echo makefile: $makefile
echo scriptdir: $scriptdir
echo docroot: $docroot
echo drupalversion: $drupalversion
echo si_options: $si_options
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 1
fi
if [ $task == 'all' ] ; then
chmod -R 777 ${sitedir}
rm -rf ${sitedir}
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
fi
echo Updating settings.php
chmod 777 ${sitedir}sites/default/settings.php
rm ${sitedir}sites/default/settings.php
cp ${scriptdir}setupfiles/su.settings.php ${sitedir}sites/default/settings.php
sed -i .bak 's/\[dbname\]/'${database}'/g' ${sitedir}sites/default/settings.php
echo Stop time:
date
echo $sitename