-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_macos
executable file
·119 lines (91 loc) · 2.34 KB
/
install_macos
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
110
111
112
113
114
115
116
117
118
119
#! /bin/sh
output() {
printf "$1"
}
all_done() {
if [[ "$1" ]]; then
printf "$1"
else
printf "✅\n"
fi
}
install_homebrew() {
output "Conditionally installing Homebrew..."
if ! type brew > /dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
all_done
}
install_xcode_select() {
output "Conditionally installing xcode-select..."
(type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
test -d "${xpath}" && test -x "${xpath}") || xcode-select --install
all_done
}
brew_bundle() {
output "Brew bundling...\n"
brew bundle --no-lock
all_done
}
install_dotfiles(){
output "Installing dotfiles...\n"
RCRC=./rcrc rcup -t macos
all_done
}
install_plugin_managers(){
output "installing plugin managers...\n"
# If vim-plug does not exist, install it.
if [ ! -d "$HOME"/.vim/autoload/plug.vim ]; then
curl -fLo "$HOME"/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
# If tmux package manager does not exist, install it.
if [ ! -d "$HOME"/.tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm
fi
all_done
}
install_rdm() {
output "Conditionally installing rdm..."
if ! type rdm > /dev/null; then
wget https://github.com/BlakeWilliams/remote-development-manager/releases/latest/download/rdm-darwin-arm64
mv rdm-darwin-arm64 /opt/homebrew/bin/rdm
chmod +x /opt/homebrew/bin/rdm
fi
all_done
}
install_gh_extensions() {
output "Conditionally installing gh extensions..."
IFS=$'\n' installed_gh_extensions=($(gh extension list))
wanted_gh_extensions=(
mislav/gh-branch
github/gh-copilot
)
for extension_to_install in "${wanted_gh_extensions[@]}"; do
found=false
for installed_extension in "${installed_gh_extensions[@]}"; do
if [[ "$installed_extension" = *"$extension_to_install"* ]]; then
found=true
fi
done
if [[ $found == true ]]; then
found=false
else
gh extensions install $extension_to_install
fi
done
all_done
}
teardown() {
output "Cleaning up..."
IFS=$' \t\n'
all_done
}
install_homebrew
install_xcode_select
brew_bundle
install_dotfiles
install_plugin_managers
install_rdm
install_gh_extensions
teardown