-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenvironment_setup.sh
executable file
·109 lines (82 loc) · 2.65 KB
/
environment_setup.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
#!/bin/bash
#set -e
confirmupdate () {
read -r -p "$1 [y/n]" response
case $response in
[yY])
true
;;
*)
false
;;
esac
}
xcode_path=`xcode-select -p`
echo ""
echo "Sets up the standard ThinkShout development environment."
echo ""
echo "There's no UNDO for this script, so please double check the prereqs now:"
echo "- Required: OSX 10.15 Catalina or higher"
echo "- Required: An active internet connection"
echo ""
if ! confirmupdate "Would you like to proceed?"; then
exit
fi
echo "Starting setup... which will install your environment or update it."
# Check Homebrew is installed.
brew_installed=`which brew`
if [ "$brew_installed" == "" ] ; then
echo $'\n'
echo "Installing Homebrew."
echo $'\n'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Check for non intel mac
is_m1=`which brew`
if [ "$is_m1" != "/opt/homebrew/bin/brew" ] ; then
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
brew update
brew doctor
fi
echo "Downloading Homebrew standard bundle."
if [ ! -d ~/ts_environment ] ; then
git clone https://github.com/thinkshout/ts_environment.git ~/ts_environment
fi
cd ~/ts_environment; git checkout main && git pull
if confirmupdate "Would you like to proceed?"; then
echo "Starting setup..."
else
exit
fi
# Install everything in the Brewfile
brew bundle --file=Brewfile
if confirmupdate "Would you like to install local development programs like PHPStorm, Sequel Ace, PHP, MariaDB, etc?"; then
echo $'\n'
echo 'Installing local development environment...'
brew bundle --file=Brewfile-dev
# Set some standard git configuration
git config --global pull.rebase true
export PATH=./vendor/bin:~/.composer/vendor/bin:/opt/homebrew/bin:$PATH
installed=`ls ~/.oh-my-zsh | grep -i 'oh-my-zsh'`
if [ "$installed" == "" ] ; then
echo $'\n'
echo ' Installing Oh My ZSH'
echo $'\n'
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
echo "export PATH=./vendor/bin:~/.composer/vendor/bin:/opt/homebrew/bin:$PATH" >> ~/.zshrc
mkdir -pv ~/.oh-my-zsh/custom
cp config/ts.zsh ~/.oh-my-zsh/custom/ts.zsh
fi
# Configure MariaDB by copying remote config file to local system.
cp config/ts.cnf $(brew --prefix)/etc/my.cnf.d/ts.cnf
brew services restart mariadb
source scripts/nginx.sh
sudo cp config/co.echo.httpdfwd.plist /Library/LaunchDaemons/
sudo launchctl load -Fw /Library/LaunchDaemons/co.echo.httpdfwd.plist
source scripts/php.sh
echo $'\n'
echo "Dev environment setup complete"
echo $'\n'
fi
exit