dotfiles/recipes/brew

34 lines
866 B
Text
Raw Normal View History

2018-02-22 04:15:49 +00:00
#!/bin/bash
set +e
function __install_brew {
case "$(uname -s)" in
Darwin)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
;;
*)
2018-02-22 15:43:19 +00:00
_recipe _apt
2018-02-22 15:46:16 +00:00
_recipe _path
2018-02-22 04:15:49 +00:00
for pkg in build-essential curl file git python-setuptools; do
_apt $pkg
done
[ -d ~/.linuxbrew ] || git clone -q https://github.com/Linuxbrew/brew.git ~/.linuxbrew
2018-02-22 15:46:16 +00:00
_path "$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin"
2018-02-22 04:15:49 +00:00
;;
esac
}
function _brew {
local pkg=$1
if ! brew ls $pkg >/dev/null 2>&1; then
_run "[brew] Install $pkg" brew install $@
else
echo "[brew] $pkg is already installed, skipping."
fi
}
if ! which brew >/dev/null; then
_run "Install brew" __install_brew
fi