From 689b4695ac356747561463c94ee93b5be1c6d5b5 Mon Sep 17 00:00:00 2001 From: "david@DAVID-PC" <3200210+davidjenni@users.noreply.github.com> Date: Sun, 21 Jan 2024 18:21:39 -0800 Subject: [PATCH] installApps ensures brew is initialized and on path - ensures retry of `bootstrap.sh apps` is idempotent --- bootstrap.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5ef4e11..d99b013 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -62,6 +62,13 @@ function writeGitConfig { done } +function initBrew { + case `uname` in + 'Darwin') eval "$(/opt/homebrew/bin/brew shellenv)" ;; + 'Linux') eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" ;; + esac +} + function ensureBrew { if have brew; then echo "$(brew --version) is installed" @@ -80,11 +87,7 @@ function ensureBrew { # https://brew.sh/ # https://docs.brew.sh/Homebrew-on-Linux NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - case `uname` in - 'Darwin') eval "$(/opt/homebrew/bin/brew shellenv)" ;; - 'Linux') eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" ;; - esac - # TODO: Test brew install + initBrew } function cloneDotFiles { @@ -133,6 +136,7 @@ function installApps { local var _apps=${apps[*]} echo ">> brew install $_apps" + initBrew brew install $_apps if [ $? -ne 0 ] ; then echo "Failed to install apps via brew"