-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrush-site-install-cli-opts.sh
114 lines (103 loc) · 2.53 KB
/
drush-site-install-cli-opts.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
#!/bin/bash
while getopts ":g:i:j:n:r:o:d:e:t:u:h:x:" opt; do
case ${opt} in
g )
DBHOST=$OPTARG
;;
i )
DBUSER=$OPTARG
;;
j )
DBPASS=$OPTARG
;;
n )
DBNAME=$OPTARG
;;
r )
RDHOST=$OPTARG
;;
o )
RDNUMBER=$OPTARG
;;
d )
DNAME=$OPTARG
;;
e )
DPASS=$OPTARG
;;
t )
DSITENAME=$OPTARG
;;
u )
DSITEEMAIL=$OPTARG
;;
x )
DELETESETTING=$OPTARG
;;
h )
echo "Command Line Options"
echo "-g Database Host"
echo "-i Database Username"
echo "-j Database Password"
echo "-n Databasse name"
echo "-r Redis Host (Optional, default: localhost)"
echo "-o Redis Number (Optional, default: 1)"
echo "-d Drupal Admin Name"
echo "-e Drupal Admin Password"
echo "-t Drupal Sitename"
echo "-u Drupal Site email address"
echo "-x Set to \"yes\" to delete the existing settings files. Default to no. No quotes around the value"
exit 1
;;
\? )
echo "Invalid Option: -$OPTARG" 1>&2
exit 1
;;
esac
done
# This determines the location of this script.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
suffix="profiles/pdsbase/scripts"
DWD=${DIR%$suffix}
if [[ -z "${DELETESETTING// }" ]]; then
DELETESETTING="no"
fi
if [[ "$DELETESETTING" = "yes" ]] ; then
chmod -R 777 ${DWD}/web/sites/default/
rm ${DWD}/web/sites/default/settings.php
fi
# Composer install is run as this will load what is in the composer.lock
composer install --no-dev
# Set defaults on Redis.
if [[ -z "${RDHOST// }" ]]; then
RDHOST="localhost"
fi
if [[ -z "${RDNUMBER// }" ]]; then
RDNUMBER="1"
fi
drush site-install pdsbase -y \
--site-name=$DSITENAME \
--site-mail=$DSITEEMAIL \
--account-name=$DNAME \
--account-pass=$DPASS \
--account-mail=$DSITEEMAIL \
--db-url=mysql://$DBUSER:$DBPASS@$DBHOST/$DBNAME ;
# Cleanup and delete text files
rm ${DWD}/web/INSTALL.txt
rm ${DWD}/web/README.txt
rm ${DWD}/web/core/CHANGELOG.txt
rm ${DWD}/web/core/COPYRIGHT.txt
rm ${DWD}/web/core/INSTALL.mysql.txt
rm ${DWD}/web/core/INSTALL.pgsql.txt
rm ${DWD}/web/core/INSTALL.sqlite.txt
rm ${DWD}/web/core/INSTALL.txt
rm ${DWD}/web/core/MAINTAINERS.txt
rm ${DWD}/web/core/UPDATE.txt
# Rename the License file to stay compliant but not easily found
mv ${DWD}/web/core/LICENSE.txt ${DWD}/web/core/license-file.txt
echo "Optimize Composer Autoloader"
cd ${DWD}
composer dump-autoload --optimize
echo "Cleaning all caches."
# Last minute cleanse.
drush cr