forked from donnemartin/dev-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gerner.sh
executable file
·79 lines (62 loc) · 2.55 KB
/
gerner.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
#!/usr/bin/env bash
# Install command-line tools using Homebrew.
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "Installing ZSH and its goodies"
brew install zsh zsh-completions zsh-syntax-highlighting
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
chsh -s /usr/local/bin/zsh
echo "ZSH_THEME=pygmalion\n# Use sublimetext for editing config files\nalias zshconfig="subl ~/.zshrc"\nalias envconfig="subl ~/Sites/config/env.sh"\nplugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting)\n# Add env.sh\n. ~/Sites/config/env.sh" >> ~/.zshrc
mkdir -p ~/Sites/config
cp env.sh ~/Sites/config/env.sh
echo "Setting up DNSMSQ"
brew install dnsmasq
cd $(brew --prefix)
mkdir etc
echo 'address=/.dev/127.0.0.1' > etc/dnsmasq.conf
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'
sudo apachectl restart
echo "TODO: \n Load: libphp5.so \n outcomment <Directory /> \n Load mod_chost_alias \n Include vhosts"
touch ~/Sites/httpd-vhosts.conf
sudo ln -s ~/Sites/httpd-vhosts.conf /etc/apache2/other
echo "<Directory \"/Users/`whoami`/Sites\">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot \"/Users/`whoami`/Sites/home/\"
ServerName home.dev
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot \"/Users/`whoami`/Sites/%1/\"
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot \"/Users/`whoami`/Sites/%-7+/\"
ServerName xip
ServerAlias *.xip.io
UseCanonicalName Off
</Virtualhost>
" > ~/Sites/httpd-vhosts.conf
sudo apachectl restart
mkdir -p ~/Sites/home
git clone https://[email protected]/cph-cloud/home.dev.git ~/Sites/home
sed -i 's/username/`whoami`/g' ~/Sites/home/config.php
sudo mkdir /private/etc/apache2/extra/vhosts
sudo touch /private/etc/apache2/extra/vhosts/empty.conf