-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnuvvv
More file actions
executable file
·102 lines (85 loc) · 3.42 KB
/
nuvvv
File metadata and controls
executable file
·102 lines (85 loc) · 3.42 KB
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
#!/bin/bash
# establish number of arguments; will check later that they were supplied
EXPECTED_ARGS=1
# NGINX CONFIG
cd ~/vvv/vagrant-local
cd config/nginx-config/sites
echo "configuring nginx for new site $1"
touch local.$1.dev.conf
echo "server {" > local.$1.dev.conf
echo " # Determines the port number that nginx will listen to for this" >> local.$1.dev.conf
echo " # server configuration. 80 is the default http port." >> local.$1.dev.conf
echo " listen 80;" >> local.$1.dev.conf
echo " " >> local.$1.dev.conf
echo " # Listen for HTTPS requests as well" >> local.$1.dev.conf
echo " listen 443 ssl;" >> local.$1.dev.conf
echo " " >> local.$1.dev.conf
echo " # Tells nginx what domain name should trigger this configuration" >> local.$1.dev.conf
echo " server_name local.$1.dev;" >> local.$1.dev.conf
echo " " >> local.$1.dev.conf
echo " # Tells nginx which directory the files for this domain are located" >> local.$1.dev.conf
echo " root /srv/www/$1;" >> local.$1.dev.conf
echo " " >> local.$1.dev.conf
echo " # Includes a basic WordPress configuration" >> local.$1.dev.conf
echo " "
echo " include /etc/nginx/nginx-wp-common.conf;" >> local.$1.dev.conf
echo "}" >> local.$1.dev.conf
echo "nginx configured"
# EDIT HOSTS FILE
echo "adding new site $1 to hosts file"
sudo bash -c "echo '192.168.50.4 local.$1.dev' >> /etc/hosts"
# DATABASE CONFIG
echo "configuring database..."
cd ~/vvv/vagrant-local/database
echo " " >> init-custom.sql
echo "CREATE DATABASE IF NOT EXISTS \`$1_db\`;" >> init-custom.sql
echo "GRANT ALL PRIVILEGES ON \`$1_db\`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';" >> init-custom.sql
# WORDPRESS SETUP
echo "setting up WordPress by cloning the default install"
cd ~/vvv/vagrant-local/www/
cp -r wordpress-default $1
# to be added when checked
# vagrant ssh
# cd /srv/www/$1/
# wp core download
# wp core config --dbname=$1_db --dbuser=wp --dbpass=wp
# wp core install --url=local.$1.dev --title=$1 --admin_user=admin --admin_password=password --admin_email=admin@$1.org
# install Genesis theme
# echo "installing the genesis theme"
# cd ~/vvv/vagrant-local/www/$1/wp-content/themes/
# wget --no-check-certificate https://dl.dropboxusercontent.com/u/**********YOUR URL HERE*************
# rm genesis-latest.zip
# remove Hello Dolly and Akismet
cd ../plugins/
rm hello.php
rm -rf akismet
# build wp-config.php
echo "building the new wp-config file"
cd ~/vvv/vagrant-local/www/$1/
echo "<?php" > wp-config.php
echo "define('DB_NAME', '$1_db');" >> wp-config.php
echo "define('DB_USER', 'wp');" >> wp-config.php
echo "define('DB_PASSWORD', 'wp');" >> wp-config.php
echo "define('DB_HOST', 'localhost');" >> wp-config.php
echo "define('DB_CHARSET', 'utf8');" >> wp-config.php
echo "define('DB_COLLATE', '');" >> wp-config.php
curl https://api.wordpress.org/secret-key/1.1/salt/ >> wp-config.php
echo "\$table_prefix = 'wp_';" >> wp-config.php
echo "define('WPLANG', '');" >> wp-config.php
echo "define('WP_DEBUG', true);" >> wp-config.php
echo "if ( !defined('ABSPATH') )" >> wp-config.php
echo " define('ABSPATH', dirname(__FILE__) . '/');" >> wp-config.php
echo "require_once(ABSPATH . 'wp-settings.php');" >> wp-config.php
# remove wp-config-sample.php
echo "removing wp-sample-config.php"
rm wp-config-sample.php
# must provision now
echo "starting the vagrant provision"
cd ~/vvv/vagrant-local
vagrant provision
# check that argument was passed
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: $0 basename"
exit
fi