├── README.md
├── mamp_pro_start_stop_script.sh
├── mamp_vh.sh
├── mampstartstop.sh
├── newsite.sh
├── startbitbucket.sh
├── vhost.sh
└── wpinstall.sh
/README.md:
--------------------------------------------------------------------------------
1 | # wp-install-script
2 | Install WordPress and a customized version of FoundationPress
3 |
4 | ## Script Location
5 | Save this `.sh` file to your scripts directory. If you don't have a scripts directory make one. I had to make one and I called it `Scripts` I placed it in my home folder, `joshsmith01/Scripts/`. Easy!
6 |
7 | ## Edit Hidden Files
8 | Next, you'll probably want to invoke this script with a simple one-line command in your Terminal so you'll have to make some more changes. You have a hidden file called `~/.bash_profile`, go to that. You might need to view hidden files. You'll have to add an alias like so: `alias wpinstall="~/Scripts/wpinstall/wpinstall.sh"`. Now you just type that alias in Terminal and you'll be set.
9 |
10 | While you're in `.bash-profile` you'll most likely need to make some other changes. You'll have to adjust where this script and the WP-CLI reads your PHP and the "`PATH`" from on your machine. Here are the three lines from my `.bash-profile` file:
11 |
12 | `export MAMP_PHP=/Applications/MAMP/bin/php/php5.6.6/bin
13 | export PATH="$MAMP_PHP:$PATH:/Applications/MAMP/Library/bin/"
14 | alias wpinstall="~/Scripts/wpinstall/wpinstall.sh"`
15 |
16 | By the way, this is all that is in this file.
17 |
18 | You have a PATH that your machine uses as a starting point for a lot of things. One of those things is the location of the PHP version you're going to use. I have MAMP installed and use that as my server. I have also created a custom location for my server directory instead of the `/htdocs/` that MAMP has as a default. The PATH can be referenced as $PATH. Replace my path to my PHP with your path to yours.
19 |
20 | ## Install WP-CLI
21 | You'll also need to install WP-CLI. You can do that from [here](http://wp-cli.org/).
--------------------------------------------------------------------------------
/mamp_pro_start_stop_script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ##
4 | # Apache HTTP Server
5 | ##
6 |
7 | . /etc/rc.common
8 | MAMP_mysql_error_log_MAMP="/Applications/MAMP/logs/mysql_error_log.err"
9 | MAMP_php_error_log_MAMP="/Applications/MAMP/logs/php_error.log"
10 |
11 | mysqlPath="/Library/Application Support/appsolute/MAMP PRO/db/mysql"
12 | mysqlTmpPath=/Applications/MAMP/tmp/mysql
13 | mysqlTmpdirPath=/Applications/MAMP/tmp/mysql/tmpdir
14 | phpTmpPath=/Applications/MAMP/tmp/php
15 | eacceleratorTmpPath=/Applications/MAMP/tmp/eaccelerator
16 | xCacheMmapPath=/Applications/MAMP/tmp/xcache
17 | xCacheCoredumpDirectory=/Applications/MAMP/tmp/phpcore
18 | fcgiTmpPath=/Applications/MAMP/tmp/fcgi_ipc
19 | mysqlLogPath="/Applications/MAMP/logs/mysql_error_log.err"
20 | phpLogPath="/Applications/MAMP/logs/php_error.log"
21 | mysqlConfPath=/Applications/MAMP/tmp/mysql/my.cnf
22 | apacheUser="www"
23 | mysqlUser="mysql"
24 |
25 | Log()
26 | {
27 | logger -t "MAMP" $1
28 | }
29 |
30 |
31 | Stop ()
32 | {
33 | if test -f /Applications/MAMP/Library/logs/httpd.pid; then
34 | Log "Stopping MAMP Apache server"
35 | /Applications/MAMP/Library/bin/apachectl -f"/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k stop
36 | fi
37 |
38 | if test -f /Applications/MAMP/tmp/mysql/mysql.pid; then
39 | Log "Stopping MAMP MySQL server"
40 | /bin/kill `cat /Applications/MAMP/tmp/mysql/mysql.pid`
41 | fi
42 |
43 | }
44 |
45 | Start ()
46 | {
47 | Log "Starting MAMP Apache web server"
48 | Stop
49 |
50 | chmod -R a+w /Applications/MAMP/db/sqlite
51 | if test -d ${phpTmpPath}; then chown -R ${apacheUser} ${phpTmpPath}; fi
52 | if test -d ${eacceleratorTmpPath}; then chown -R ${apacheUser} ${eacceleratorTmpPath}; fi
53 | if test -d ${fcgiTmpPath}; then chown -R ${apacheUser} ${fcgiTmpPath}; fi
54 | if test -f ${xCacheMmapPath}; then chown ${apacheUser} ${xCacheMmapPath}; fi
55 | if test -d ${xCacheCoredumpDirectory}; then chown -R ${apacheUser} ${xCacheCoredumpDirectory}; fi
56 | touch "${phpLogPath}"
57 | chown ${apacheUser} "${phpLogPath}"
58 | /Applications/MAMP/Library/bin/apachectl -f"/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k start
59 |
60 | Log "Starting MAMP MySQL server"
61 | chown ${mysqlUser} "${mysqlLogPath}"
62 | chmod 0640 "${mysqlLogPath}"
63 |
64 | chown -R ${mysqlUser} "${mysqlPath}"
65 | if [ ! -d ${mysqlTmpdirPath} ]; then mkdir ${mysqlTmpdirPath}; fi
66 | chown -R ${mysqlUser} ${mysqlTmpPath}
67 |
68 | for i in "${mysqlPath}"/*; do
69 | if [ -f "$i" ]; then
70 | chmod 0660 "$i"
71 | else
72 | if [ -d "$i" ]; then
73 | chmod -R 0600 "$i"
74 | chmod 0775 "$i"
75 | fi
76 | fi
77 | done
78 |
79 | if [ -f ${mysqlConfPath} ]; then
80 | chown ${mysqlUser} ${mysqlConfPath}
81 | chmod 0660 ${mysqlConfPath}
82 | fi
83 |
84 | /Applications/MAMP/Library/bin/mysqld_safe --defaults-file=${mysqlConfPath} --user=${mysqlUser} --port=MAMP_MysqlPort_MAMP --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error="$mysqlLogPath" --tmpdir=${mysqlTmpdirPath} --datadir=/Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql
85 | }
86 |
87 |
88 | Restart ()
89 | {
90 | Stop
91 | Start
92 | }
93 |
94 | "$1" &
--------------------------------------------------------------------------------
/mamp_vh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 |
3 | RED="\033[0;31m"
4 | YELLOW="\033[33m"
5 | REDBG="\033[0;41m"
6 | WHITE="\033[1;37m"
7 | NC="\033[0m"
8 |
9 | mkdir -p /Applications/MAMP/Library/vhosts;
10 | mkdir -p /Applications/MAMP/Library/vhosts/domains;
11 |
12 | if [ "$1" = "create" ] || [ "$1" = "add" ]; then
13 | # Ask for document root
14 | echo -e "${RED}Enter the document root (relative to 'htdocs'):${NC}";
15 | read documentRoot;
16 |
17 | # Ask for domain name
18 | echo -e "${RED}Enter local domain: (eg. local.com):${NC}";
19 | read domain;
20 |
21 | # Ask for port number
22 | echo -e "${RED}Enter MAMP Port Nubmer:${NC}";
23 | read port;
24 |
25 | # Add vhost
26 | touch /Applications/MAMP/Library/vhosts/domains/$domain;
27 |
28 | echo "
29 | DocumentRoot "/Applications/MAMP/htdocs/$documentRoot"
30 | ServerName $domain
31 |
32 | Options All
33 | AllowOverride All
34 | Order allow,deny
35 | Allow from all
36 |
37 | " >> /Applications/MAMP/Library/vhosts/domains/$domain;
38 |
39 | echo "127.0.0.1 $domain" >> /etc/hosts;
40 |
41 | # Restart MAMP
42 | /Applications/MAMP/bin/apache2/bin/apachectl restart;
43 |
44 | # echo out the domain name and copy domain to clipboard
45 | echo -e "Finished. ${REDBG}${WHITE}$domain:$port${NC} has been copied to your clipboard.";
46 | echo "$domain:$port" | pbcopy;
47 | fi
48 |
49 | if [ "$1" = "remove" ] || [ "$1" = "delete" ]; then
50 | echo -e "${RED}Here are the current custom local domains:${NC}"
51 | for file in /Applications/MAMP/Library/vhosts/domains/*
52 | do
53 | if [ -f "$file" ];then
54 | echo -e "${YELLOW}${file##/*/}${NC}"
55 | fi
56 | done
57 | echo -e "${RED}Enter the site name you wish to remove:${NC}"
58 | read siteName;
59 |
60 | sed -i.bak "/$siteName/d" /etc/hosts;
61 | rm /Applications/MAMP/Library/vhosts/domains/$siteName;
62 |
63 | echo -e "${YELLOW}$siteName removed."
64 | fi
--------------------------------------------------------------------------------
/mampstartstop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ##
4 | # Apache HTTP Server
5 | ##
6 |
7 | . /etc/rc.common
8 | MAMP_mysql_error_log_MAMP="/Applications/MAMP/logs/mysql_error_log.err"
9 | MAMP_php_error_log_MAMP="/Applications/MAMP/logs/php_error.log"
10 |
11 | mysqlPath="/Library/Application Support/appsolute/MAMP PRO/db/mysql"
12 | mysqlTmpPath=/Applications/MAMP/tmp/mysql
13 | mysqlTmpdirPath=/Applications/MAMP/tmp/mysql/tmpdir
14 | phpTmpPath=/Applications/MAMP/tmp/php
15 | eacceleratorTmpPath=/Applications/MAMP/tmp/eaccelerator
16 | xCacheMmapPath=/Applications/MAMP/tmp/xcache
17 | xCacheCoredumpDirectory=/Applications/MAMP/tmp/phpcore
18 | fcgiTmpPath=/Applications/MAMP/tmp/fcgi_ipc
19 | mysqlLogPath="/Applications/MAMP/logs/mysql_error_log.err"
20 | phpLogPath="/Applications/MAMP/logs/php_error.log"
21 | mysqlConfPath=/Applications/MAMP/tmp/mysql/my.cnf
22 | apacheUser="www"
23 | mysqlUser="mysql"
24 |
25 | Log()
26 | {
27 | logger -t "MAMP" $1
28 | }
29 |
30 |
31 | Stop ()
32 | {
33 | if test -f /Applications/MAMP/Library/logs/httpd.pid; then
34 | Log "Stopping MAMP Apache server"
35 | /Applications/MAMP/Library/bin/apachectl -f"/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k stop
36 | fi
37 |
38 | if test -f /Applications/MAMP/tmp/mysql/mysql.pid; then
39 | Log "Stopping MAMP MySQL server"
40 | /bin/kill `cat /Applications/MAMP/tmp/mysql/mysql.pid`
41 | fi
42 |
43 | }
44 |
45 | Start ()
46 | {
47 | Log "Starting MAMP Apache web server"
48 | Stop
49 |
50 | chmod -R a+w /Applications/MAMP/db/sqlite
51 | if test -d ${phpTmpPath}; then chown -R ${apacheUser} ${phpTmpPath}; fi
52 | if test -d ${eacceleratorTmpPath}; then chown -R ${apacheUser} ${eacceleratorTmpPath}; fi
53 | if test -d ${fcgiTmpPath}; then chown -R ${apacheUser} ${fcgiTmpPath}; fi
54 | if test -f ${xCacheMmapPath}; then chown ${apacheUser} ${xCacheMmapPath}; fi
55 | if test -d ${xCacheCoredumpDirectory}; then chown -R ${apacheUser} ${xCacheCoredumpDirectory}; fi
56 | touch "${phpLogPath}"
57 | chown ${apacheUser} "${phpLogPath}"
58 | /Applications/MAMP/Library/bin/apachectl -f"/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k start
59 |
60 | Log "Starting MAMP MySQL server"
61 | chown ${mysqlUser} "${mysqlLogPath}"
62 | chmod 0640 "${mysqlLogPath}"
63 |
64 | chown -R ${mysqlUser} "${mysqlPath}"
65 | if [ ! -d ${mysqlTmpdirPath} ]; then mkdir ${mysqlTmpdirPath}; fi
66 | chown -R ${mysqlUser} ${mysqlTmpPath}
67 |
68 | for i in "${mysqlPath}"/*; do
69 | if [ -f "$i" ]; then
70 | chmod 0660 "$i"
71 | else
72 | if [ -d "$i" ]; then
73 | chmod -R 0600 "$i"
74 | chmod 0775 "$i"
75 | fi
76 | fi
77 | done
78 |
79 | if [ -f ${mysqlConfPath} ]; then
80 | chown ${mysqlUser} ${mysqlConfPath}
81 | chmod 0660 ${mysqlConfPath}
82 | fi
83 |
84 | /Applications/MAMP/Library/bin/mysqld_safe --defaults-file=${mysqlConfPath} --user=${mysqlUser} --port=MAMP_MysqlPort_MAMP --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error="$mysqlLogPath" --tmpdir=${mysqlTmpdirPath} --datadir=/Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql
85 | }
86 |
87 |
88 | Restart ()
89 | {
90 | Stop
91 | Start
92 | }
93 |
94 | "$1" &
--------------------------------------------------------------------------------
/newsite.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 |
3 | #Output commands to get site details
4 | read -p "New local site name: " SITE
5 |
6 | #change path to SITEPATH =" your path/${SITE}"
7 | SITEPATH="/Users/joshsmith01/sites/${SITE}"
8 |
9 | # private/etc/hosts
10 | # Change extension (l.localhost.com) to match your normal url pattern
11 | echo "127.0.0.1\t${SITE}.localhost.com" >> /private/etc/hosts
12 |
13 | #http-vhosts.conf
14 | #Change extension (l.localhost.com) to match your normal url pattern
15 | VHOSTSFILE="/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf"
16 |
17 |
18 | echo "" >> $VHOSTSFILE
19 | echo "\tServerName ${SITE}.localhost.com" >>$VHOSTSFILE
20 | echo "\tDocumentRoot \"${SITEPATH}\"" >> $VHOSTSFILE
21 | echo "\t" >> $VHOSTSFILE
22 | echo "Options Indexes FollowSymLinks MultiViews" >> $VHOSTSFILE
23 | echo "AllowOverride All" >> $VHOSTSFILE
24 | echo "Order allow,deny" >> $VHOSTSFILE
25 | echo "allow from all" >> $VHOSTSFILE
26 | echo "" >> $VHOSTSFILE
27 | echo "" >> $VHOSTSFILE
28 |
29 |
30 | #Restarts MAMP (changed to your url if apachectl.sh is in a differnet location on your MAMP install)
31 | /Applications/MAMP/bin/apache2/bin/apachectl restart;
32 |
--------------------------------------------------------------------------------
/startbitbucket.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 |
3 | echo "hello"
4 | function startbitbucket {
5 | echo 'Username?'
6 | read username
7 | echo 'Password?'
8 | read password
9 | echo 'Repo name?'
10 | read reponame
11 |
12 | git init
13 | git add -A .
14 | git commit -m "Initial commit"
15 | # curl --user $username:$password https://api.bitbucket.org/1.0/repositories/ --data name=$reponame --data is_private='true'
16 | curl -X POST -v -u ${username}:${password} -H "Content-Type: application/json" https://api.bitbucket.org/2.0/repositories/${username}/${reponame} -d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }'
17 |
18 | git remote add origin git@bitbucket.org:$username/$reponame.git
19 | git push -u origin --all
20 | git push -u origin --tags
21 | }
22 | startbitbucket
--------------------------------------------------------------------------------
/vhost.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | # https://gist.github.com/rsanchez/7139776
3 | vhost( ) {
4 | if [[ -z $1 ]]; then
5 | echo 'usage: vhost [hostname]'
6 | return
7 | fi
8 |
9 | HOST=$1
10 | HOSTNAME="$HOST.dev"
11 | ADDRESS="127.0.0.1"
12 | SITEPATH="$HOME/Sites/$HOST"
13 | SETTINGSFILE="$HOME/Library/Application Support/appsolute/MAMP PRO/settings.plist"
14 | HOSTSFILE="$HOME/Library/Application Support/appsolute/MAMP PRO/writtenHosts.plist"
15 |
16 | if [[ ! -d "$SITEPATH" ]]; then
17 | mkdir "$SITEPATH"
18 | fi
19 |
20 | /usr/libexec/PlistBuddy -c "Add :virtualHosts: dict" "$SETTINGSFILE"
21 | SETTINGSINDEX=$(/usr/libexec/PlistBuddy -c "Print :virtualHosts: dict" "$SETTINGSFILE" | grep documentRoot | wc -l | tr -d ' ')
22 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Allow integer 0" "$SETTINGSFILE"
23 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:AllowOverride integer 0" "$SETTINGSFILE"
24 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:ExecCGI bool false" "$SETTINGSFILE"
25 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:FollowSymLinks bool true" "$SETTINGSFILE"
26 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Includes bool true" "$SETTINGSFILE"
27 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Indexes bool false" "$SETTINGSFILE"
28 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:MultiViews bool false" "$SETTINGSFILE"
29 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Order integer 0" "$SETTINGSFILE"
30 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:SymLinksifOwnerMatch bool false" "$SETTINGSFILE"
31 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:documentRoot string $SITEPATH" "$SETTINGSFILE"
32 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:dyndns dict" "$SETTINGSFILE"
33 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:dyndns:displayName string -" "$SETTINGSFILE"
34 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:local bool true" "$SETTINGSFILE"
35 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:serverAliases array" "$SETTINGSFILE"
36 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:serverName string $HOSTNAME" "$SETTINGSFILE"
37 | /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:ssl bool false" "$SETTINGSFILE"
38 |
39 | /usr/libexec/PlistBuddy -c "Add :writtenHosts: array" "$HOSTSFILE"
40 | HOSTSINDEX=$(/usr/libexec/PlistBuddy -c "Print :writtenHosts: array" "$HOSTSFILE" | grep Array | wc -l | tr -d ' ' | expr $(cat -) - 2)
41 | /usr/libexec/PlistBuddy -c "Add :writtenHosts:$HOSTSINDEX:0 string $HOSTNAME" "$HOSTSFILE"
42 | /usr/libexec/PlistBuddy -c "Add :writtenHosts:$HOSTSINDEX:1 string $ADDRESS" "$HOSTSFILE"
43 | }
--------------------------------------------------------------------------------
/wpinstall.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -e
2 | # Possible Trouble Shooting Tip
3 | # *Ensure the PHP that MAMP is using is the same as the the PHP wp-cli is using
4 | #
5 |
6 | RED="\033[0;31m"
7 | YELLOW="\033[33m"
8 | REDBG="\033[0;41m"
9 | WHITE="\033[1;37m"
10 | NC="\033[0m"
11 |
12 | clear
13 | echo -e "${RED}=================================================================${NC}"
14 | echo -e "${REDBG}${WHITE}Awesome WordPress and FoundationPress Theme Installer!!${NC}"
15 | echo -e "${RED}=================================================================${NC}"
16 |
17 |
18 | # accept the name of our website
19 | echo "$(tput setaf 4)$(tput setab 7)Site Name:$(tput sgr 0)"
20 | read -e sitename
21 |
22 | # accept a comma separated list of pages
23 | echo "$(tput setaf 4)$(tput setab 7)Add a comma separated list of pages:$(tput sgr 0)"
24 | read -e allpages
25 |
26 | # add a simple yes/no confirmation before we proceed
27 | echo "$(tput setaf 4)$(tput setab 7)What's your first name$(tput sgr 0)"
28 | read -e myname
29 |
30 | # add a simple yes/no confirmation before we proceed
31 | echo "$(tput setaf 4)$(tput setab 7)Run Install? (y/n)$(tput sgr 0)"
32 | read -e run
33 |
34 | ## variables ##
35 | # clean up site names and directory names
36 | dbname="$(echo -e "${sitename}" | tr -d '[[:space:]]' | tr '[:upper:]' '[:lower:]' | head -c 10)"
37 | sitedirectory="$(echo -e "${sitename}" | tr -s ' ' '-' | tr '[:upper:]' '[:lower:]')"
38 |
39 | myname="$(echo -e "${myname}" | tr '[:upper:]' '[:lower:]')"
40 |
41 | # My path to my server host directory
42 | # Those who clone this will likely need to change this path to their own hosting directory.
43 | dirpath=$HOME/sites/
44 | # assign user naming conventions
45 | wpuser='dev_'${sitedirectory}
46 | fpthemename=${sitename}'_theme'
47 | adminemail='joshsmith01.contact@gmail.com'
48 | siteurl='http://'${sitedirectory}
49 |
50 | echo -e "${RED}=================================================================${NC}"
51 | echo -e "${REDBG}${WHITE}Enter Your Bitbucket Credentials${NC}"
52 | echo -e "${RED}=================================================================${NC}"
53 |
54 | echo 'Username?'
55 | read username
56 | echo 'Password?'
57 | read -s password
58 | # Verify what directory I'm in.
59 | pwd
60 | # Clone my repo from GitHub
61 | # git clone git@github.com:joshsmith01/wp-install-script.git
62 |
63 | # Then exit the script
64 | # exit
65 |
66 |
67 | # # test to see if the directory can be made
68 | # mkdir -p /Applications/MAMP/Library/vhosts;
69 | # mkdir -p /Applications/MAMP/Library/vhosts/domains;
70 | #
71 | #
72 | # # Add vhost
73 | # touch /Applications/MAMP/Library/vhosts/domains/${sitedirectory};
74 | #
75 | # echo "
76 | # DocumentRoot "~/sites/${sitedirectory}"
77 | # ServerName ${sitedirectory}
78 | #
79 | # Options All
80 | # AllowOverride All
81 | # Order allow,deny
82 | # Allow from all
83 | #
84 | # " >> /Applications/MAMP/Library/vhosts/domains/${sitedirectory};
85 | #
86 | # echo "127.0.0.1 ${sitedirectory}" >> changehosts;
87 | # echo "past the etc"
88 | # # Restart MAMP
89 | # sudo /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k restart
90 | # echo "mamp restart"
91 | # exit
92 |
93 |
94 |
95 | # #!/bin/bash -e
96 | # # https://gist.github.com/rsanchez/7139776
97 | # vhost( ) {
98 | # if [[ -z $1 ]]; then
99 | # echo 'usage: vhost [hostname]'
100 | # return
101 | # fi
102 |
103 | # HOST=$1
104 | # HOSTNAME="$HOST.dev"
105 | # ADDRESS="127.0.0.1"
106 | # SITEPATH="$HOME/Sites/$HOST"
107 | # SETTINGSFILE="$HOME/Library/Application Support/appsolute/MAMP PRO/settings.plist"
108 | # HOSTSFILE="$HOME/Library/Application Support/appsolute/MAMP PRO/writtenHosts.plist"
109 |
110 | # if [[ ! -d "$SITEPATH" ]]; then
111 | # mkdir "$SITEPATH"
112 | # fi
113 |
114 | # echo 'hello'
115 |
116 |
117 |
118 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts: dict" "$SETTINGSFILE"
119 | # SETTINGSINDEX=$(/usr/libexec/PlistBuddy -c "Print :virtualHosts: dict" "$SETTINGSFILE" | grep documentRoot | wc -l | tr -d ' ')
120 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Allow integer 0" "$SETTINGSFILE"
121 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:AllowOverride integer 0" "$SETTINGSFILE"
122 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:ExecCGI bool false" "$SETTINGSFILE"
123 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:FollowSymLinks bool true" "$SETTINGSFILE"
124 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Includes bool true" "$SETTINGSFILE"
125 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Indexes bool false" "$SETTINGSFILE"
126 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:MultiViews bool false" "$SETTINGSFILE"
127 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:Order integer 0" "$SETTINGSFILE"
128 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:SymLinksifOwnerMatch bool false" "$SETTINGSFILE"
129 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:documentRoot string $SITEPATH" "$SETTINGSFILE"
130 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:dyndns dict" "$SETTINGSFILE"
131 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:dyndns:displayName string -" "$SETTINGSFILE"
132 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:local bool true" "$SETTINGSFILE"
133 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:serverAliases array" "$SETTINGSFILE"
134 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:serverName string $HOSTNAME" "$SETTINGSFILE"
135 | # /usr/libexec/PlistBuddy -c "Add :virtualHosts:$SETTINGSINDEX:ssl bool false" "$SETTINGSFILE"
136 |
137 | # /usr/libexec/PlistBuddy -c "Add :writtenHosts: array" "$HOSTSFILE"
138 | # HOSTSINDEX=$(/usr/libexec/PlistBuddy -c "Print :writtenHosts: array" "$HOSTSFILE" | grep Array | wc -l | tr -d ' ' | expr $(cat -) - 2)
139 | # /usr/libexec/PlistBuddy -c "Add :writtenHosts:$HOSTSINDEX:0 string $HOSTNAME" "$HOSTSFILE"
140 | # /usr/libexec/PlistBuddy -c "Add :writtenHosts:$HOSTSINDEX:1 string $ADDRESS" "$HOSTSFILE"
141 | # }
142 |
143 | # exit
144 |
145 |
146 |
147 | # if the user didn't say no, then go ahead and install
148 | if [ "$run" == n ] ; then
149 | exit
150 | else
151 |
152 | # check to see if the desired directory exists and create it if it doesn't
153 | if [ ! -d ${dirpath}$sitedirectory ] ; then
154 | mkdir ${dirpath}$sitedirectory
155 | fi
156 |
157 | # Print the current directory first, then...
158 | # pwd
159 |
160 | # Move to the correct directory which should be where you create all your other sites...mine is in /sites
161 | # move controller into that newly created directory
162 | cd ${dirpath}$sitedirectory
163 |
164 | # Download
165 | wp core download
166 | # delete all themes and then reinstall twentyfifteen
167 |
168 | wp core config --dbname=$dbname --dbuser=root --dbpass=root --extra-php <