mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-23 11:09:50 +00:00
41 lines
1.1 KiB
Bash
41 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# Description: Package manager - Homebrew on OSX, Linuxbrew on Linux
|
|
set -e
|
|
|
|
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
|
|
}
|
|
|
|
function _brew_cask {
|
|
local pkg=$1
|
|
if ! brew cask list $pkg >/dev/null 2>&1; then
|
|
_run "[brew cask] Install $pkg" brew cask install $@
|
|
else
|
|
echo "[brew cask] $pkg is already installed, skipping."
|
|
fi
|
|
}
|
|
|
|
case "$(uname -s)" in
|
|
Darwin)
|
|
if ! which brew >/dev/null; then
|
|
_run "Install brew" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
fi
|
|
;;
|
|
*)
|
|
_recipe _apt
|
|
_recipe _path
|
|
|
|
for pkg in build-essential curl file gawk git python-setuptools; do
|
|
_apt $pkg
|
|
done
|
|
if ! [ -d ~/.linuxbrew ]; then
|
|
_run "Install brew" git clone -q https://github.com/Linuxbrew/brew.git ~/.linuxbrew
|
|
fi
|
|
_path "$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin"
|
|
;;
|
|
esac
|