Skip to content

Instantly share code, notes, and snippets.

@h0tw1r3
Created July 28, 2022 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h0tw1r3/4c00f41c01b77e7e6dd6713135851cb1 to your computer and use it in GitHub Desktop.
Save h0tw1r3/4c00f41c01b77e7e6dd6713135851cb1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# halt on any errors
set -o pipefail -e
BREW_INSTALL_PATH=/home/linuxbrew/.linuxbrew
if ! [ -x "/home/linuxbrew/.linuxbrew/bin/brew" ] ; then
if ! sudo -l -U root >/dev/null 2>&1 ; then
echo "root sudo permission required to install"
exit 2
fi
echo "=== Installing homebrew"
if ! [ -f "${BREW_INSTALL_PATH}" ] ; then
echo "=== Installing required packages"
sudo yum -y groupinstall 'Development Tools'
sudo yum -y install procps-ng curl file git
sudo yum -y install libxcrypt-compat || true
sudo mkdir -p "${BREW_INSTALL_PATH}"
sudo chown -R "${USER}:" "${BREW_INSTALL_PATH}"
fi
cd /home/linuxbrew/.linuxbrew
echo "=== Downloading Homebrew from github.com"
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C .
eval "$(bin/brew shellenv)"
echo "=== Updating Homebrew"
brew update --force --quiet
else
eval "$("${BREW_INSTALL_PATH}"/bin/brew shellenv)"
fi
set +o pipefail +e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment