-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinit.sh
executable file
·58 lines (45 loc) · 1.48 KB
/
init.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
#!/usr/bin/env bash
function prepare_homebrew {
if command -v brew; then
echo "+ Update Homebrew"
brew update -v
rm -rf "$(brew --cache)"
else
echo "+ Install Homebrew"
# https://github.com/Homebrew/install/tree/master
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
if [[ ! -f ~/.config/.HomebrewEnvSetupDone ]]; then
# `/opt/homebrew/bin/brew` in Apple Silicon device
# `/usr/local/bin/brew` in Intel device
brew_bin='/opt/homebrew/bin/brew'
echo "+ brew bin path: ${brew_bin}"
${brew_bin} shellenv
(echo; ${brew_bin} shellenv) >> ~/.zprofile >> ~/.bash_profile
eval "$(${brew_bin} shellenv)"
if command -v brew; then
echo "+ Homebrew Installed"
mkdir -p ~/.config
touch ~/.config/.HomebrewEnvSetupDone
else
echo "+ [Error] Homebrew or environment variables setup failed, check: https://brew.sh"
exit 1
fi
fi
fi
}
prepare_homebrew
####################
set -ex
workspace="`pwd`"
if [[ -n $1 ]]; then
workspace="$1"
cd "$workspace"
fi
function install_flow {
# bash "${workspace}/init-proxy.sh"
bash "${workspace}/init-zsh.sh"
zsh init-application.sh
zsh init-sys-preference.sh
zsh init-app-preference.sh
}
install_flow 2>&1 | tee install.log