-
Notifications
You must be signed in to change notification settings - Fork 208
/
Copy pathbootstrap_wordpress.sh
executable file
·60 lines (45 loc) · 1.19 KB
/
bootstrap_wordpress.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
#!/bin/bash
TOPDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
HOSTNAME=${1:-creativecommons.org}
DBNAME=${2:-wordpress}
DBUSER=${3:-dbuser}
DBPASS=${4:-}
pushd ${TOPDIR}
#
# composer
#
wget -O - https://getcomposer.org/installer | php
#
# WordPress
#
php ${TOPDIR}/composer.phar install
# Make sure wp-content hierarchy is correct
mkdir -p ${TOPDIR}/docroot/wp-content/themes
mkdir -p ${TOPDIR}/docroot/wp-content/uploads
chgrp -R www-data ${TOPDIR}/docroot/wp-content/uploads
#
# Theme
#
if [ ! -d "${TOPDIR}/cc-wp-theme" ]
then
git clone https://github.com/creativecommons/cc-wp-theme.git \
"${TOPDIR}/cc-wp-theme"
else
pushd "${TOPDIR}/cc-wp-theme"
git pull
popd
fi
if [ ! -d "${TOPDIR}/docroot/wp-content/themes/creativecommons.org" ]
then
ln -s "${TOPDIR}/cc-wp-theme/creativecommons.org" \
"docroot/wp-content/themes/creativecommons.org"
ln -s "${TOPDIR}/cc-wp-theme/creativecommons.org" \
"docroot/wp-content/themes/twentyfourteen"
fi
#
# wp-config-local.php
#
sed -e "s|@dbname@|${DBNAME}|;s|@dbuser@|${DBUSER}|;s|@dbpass@|${DBPASS}|" \
< "docroot/wp-config-local.php.in" \
> "docroot/wp-config-local.php"
popd # to original