-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-brew.zsh
executable file
·64 lines (52 loc) · 1.08 KB
/
install-brew.zsh
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
is_brew_installed() {
command -v brew &> /dev/null
}
install_homebrew() {
echo "Installing homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
}
is_package_installed() {
brew list "$1" &> /dev/null
}
install_package() {
local package="$1"
if is_package_installed "$package"; then
echo "$package is already installed"
return
fi
echo "Installing $package ..."
brew install "$package" && echo "$package is installed"
# Post-install actions
post_install_actions "$package"
}
post_install_actions() {
local package="$1"
if [[ "$package" == "fzf" ]]; then
$(brew --prefix)/opt/fzf/install
fi
}
main() {
if ! is_brew_installed; then
install_homebrew
else
echo "Homebrew is already installed"
fi
# List of packages
local packages=(
"jq"
"fzf"
"autojump"
"ripgrep"
"MonitorControl"
"bat"
"thefuck"
"tldr"
"diff-so-fancy"
"wget"
)
for package in "${packages[@]}"; do
install_package "$package"
done
}
# Start the main function
main