Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

Commit 9da1e33

Browse files
ejschaeferferdingler
authored andcommitted
skip homebrew installation if already installed; use apt-get if installed or use yum if installed
1 parent 7a5f3d9 commit 9da1e33

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

workshop/static/assets/bootstrap.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ function upgrade_sam_cli() {
4040

4141
function upgrade_existing_packages() {
4242
_logger "[+] Upgrading system packages"
43-
sudo yum update -y
43+
if [[ $(command -v apt-get) ]]; then
44+
sudo apt-get upgrade -y
45+
elif [[ $(command -v yum) ]]; then
46+
sudo yum update -y
47+
fi
4448

4549
_logger "[+] Upgrading Python pip and setuptools"
4650
python3 -m pip install --upgrade pip setuptools --user
@@ -60,13 +64,18 @@ function install_utility_tools() {
6064
function install_linuxbrew() {
6165
_logger "[+] Creating touch symlink"
6266
sudo ln -sf /bin/touch /usr/bin/touch
63-
_logger "[+] Installing homebrew..."
64-
echo | sh -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
65-
_logger "[+] Adding homebrew in PATH"
66-
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
67-
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
68-
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
69-
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
67+
68+
if [[ $(command -v brew) == "" ]]; then
69+
_logger "[+] Installing homebrew..."
70+
echo | sh -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
71+
_logger "[+] Adding homebrew in PATH"
72+
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
73+
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
74+
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
75+
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
76+
else
77+
_logger "[+] Homebrew already installed..."
78+
fi
7079
}
7180

7281
function main() {

0 commit comments

Comments
 (0)