aboutsummaryrefslogtreecommitdiffstats
path: root/shlib/homebrew.sh
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2025-11-01 21:25:17 -0400
committerEugene Triguba <hello@eugenetriguba.com>2025-11-01 21:25:17 -0400
commitfe351483777c8d053d9f8b584278a4c2b162db0e (patch)
tree15af9419e315bfad090c940be4a61625bf785876 /shlib/homebrew.sh
parentMove /usr/local/bin farther up the path (diff)
downloaddotfiles-fe351483777c8d053d9f8b584278a4c2b162db0e.zip
Update install scripts for macos and linux and use sh
Diffstat (limited to 'shlib/homebrew.sh')
-rw-r--r--shlib/homebrew.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/shlib/homebrew.sh b/shlib/homebrew.sh
new file mode 100644
index 0000000..a00ad73
--- /dev/null
+++ b/shlib/homebrew.sh
@@ -0,0 +1,20 @@
+# shellcheck shell=sh
+[ -n "${DOTFILES_HOMEBREW_LOADED}" ] && return
+readonly DOTFILES_HOMEBREW_LOADED=1
+
+homebrew_is_installed() {
+ command -v brew >/dev/null 2>&1
+}
+
+# Installs homebrew and verifies the installation.
+#
+# If the install was not successful, exits with a
+# 1 status code.
+homebrew_install() {
+ /usr/bin/env bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+ eval "$(/opt/homebrew/bin/brew shellenv)"
+ if ! command -v brew >/dev/null 2>&1; then
+ echo "Failed to install homebrew"
+ return 1
+ fi
+}