switch to HOME-based local 'brew'
authorAJ ONeal <coolaj86@gmail.com>
Mon, 13 Jul 2020 19:52:54 +0000 (13:52 -0600)
committerAJ ONeal <aj@therootcompany.com>
Mon, 13 Jul 2020 20:23:02 +0000 (20:23 +0000)
brew/install.sh

index 34b5a0da455fef905eedd5333f95b6e9d0345647..93220ddb246fd61e72959745bb80f08792ea0f0f 100644 (file)
@@ -1,4 +1,37 @@
 #!/bin/bash
 
-# Straight from https://brew.sh
-/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
+set -e
+set -u
+
+{
+    # Straight from https://brew.sh
+    #/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
+
+    # From Straight from https://brew.sh
+    if ! [ -d "$HOME/.local/opt/brew" ]; then
+        echo "Installing to '$HOME/.local/opt/brew'"
+        echo ""
+        echo "If you prefer to have brew installed to '/usr/local' cancel now and do the following:"
+        echo "        rm -rf '$HOME/.local/opt/brew'"
+        echo '        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
+        echo ""
+        sleep 3
+        git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.local/opt/brew"
+    fi
+
+    webi_path_add "$HOME/.local/opt/brew/bin"
+    export PATH="$HOME/.local/opt/brew/bin:$PATH"
+
+    echo "Updating brew..."
+    brew update
+
+    webi_path_add "$HOME/.local/opt/brew/sbin"
+    export PATH="$HOME/.local/opt/brew/sbin:$PATH"
+
+    echo "Installed 'brew' to '$HOME/.local/opt/brew'"
+    echo ""
+    echo "If you prefer to have brew installed to '/usr/local' do the following:"
+    echo "        mv '$HOME/.local/opt/brew' '$HOME/.local/opt/brew.$(date '+%F_%H-%M-%S').bak'"
+    echo '        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
+    echo ""
+}