93220ddb246fd61e72959745bb80f08792ea0f0f
[webi-installers/.git] / brew / install.sh
1 #!/bin/bash
2
3 set -e
4 set -u
5
6 {
7     # Straight from https://brew.sh
8     #/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
9
10     # From Straight from https://brew.sh
11     if ! [ -d "$HOME/.local/opt/brew" ]; then
12         echo "Installing to '$HOME/.local/opt/brew'"
13         echo ""
14         echo "If you prefer to have brew installed to '/usr/local' cancel now and do the following:"
15         echo "        rm -rf '$HOME/.local/opt/brew'"
16         echo '        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
17         echo ""
18         sleep 3
19         git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.local/opt/brew"
20     fi
21
22     webi_path_add "$HOME/.local/opt/brew/bin"
23     export PATH="$HOME/.local/opt/brew/bin:$PATH"
24
25     echo "Updating brew..."
26     brew update
27
28     webi_path_add "$HOME/.local/opt/brew/sbin"
29     export PATH="$HOME/.local/opt/brew/sbin:$PATH"
30
31     echo "Installed 'brew' to '$HOME/.local/opt/brew'"
32     echo ""
33     echo "If you prefer to have brew installed to '/usr/local' do the following:"
34     echo "        mv '$HOME/.local/opt/brew' '$HOME/.local/opt/brew.$(date '+%F_%H-%M-%S').bak'"
35     echo '        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
36     echo ""
37 }