2013-03-22 10:15:50 -07:00
|
|
|
function is_deb {
|
|
|
|
command_exists apt-get
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_mac {
|
|
|
|
[[ $(uname) == 'Darwin' ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_linux {
|
|
|
|
[[ $(uname) == 'Linux' ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if is_mac; then
|
|
|
|
|
2013-10-21 03:45:56 -07:00
|
|
|
# Check to see if the (mac) app exists
|
|
|
|
function app_exists {
|
|
|
|
[ -d /Applications/"$1" ] || [ -e /Applications/"$1".app ] || [ -e ~/Applications/"$1".app ]
|
|
|
|
}
|
|
|
|
|
2013-10-18 06:53:01 -07:00
|
|
|
if command_exists brew; then
|
2013-03-22 10:15:50 -07:00
|
|
|
|
2013-10-18 06:53:01 -07:00
|
|
|
function pkg_install() {
|
|
|
|
brew install $1
|
|
|
|
}
|
2013-03-22 10:15:50 -07:00
|
|
|
|
2013-10-18 06:53:01 -07:00
|
|
|
function pkg_remove() {
|
|
|
|
brew remove $1
|
|
|
|
}
|
|
|
|
|
|
|
|
function pkg_update() {
|
|
|
|
brew update && brew upgrade
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
function pkg_install() {
|
|
|
|
echo_r "Homebrew not installed"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
function pkg_remove() {
|
|
|
|
echo_r "Homebrew not installed"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
function pkg_update() {
|
|
|
|
echo_r "Homebrew not installed"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
fi
|
2013-03-22 10:15:50 -07:00
|
|
|
|
|
|
|
elif is_deb; then
|
|
|
|
|
2013-10-18 04:03:28 -07:00
|
|
|
function pkg_install() {
|
2013-05-05 15:14:07 -07:00
|
|
|
sudo apt-get -y install $1
|
2013-03-22 10:15:50 -07:00
|
|
|
}
|
|
|
|
|
2013-10-18 04:03:28 -07:00
|
|
|
function pkg_remove() {
|
2013-05-05 15:14:07 -07:00
|
|
|
sudo apt-get -y remove $1
|
2013-03-22 10:15:50 -07:00
|
|
|
}
|
|
|
|
|
2013-10-18 04:03:28 -07:00
|
|
|
function pkg_update() {
|
2013-03-22 10:15:50 -07:00
|
|
|
sudo apt-get update && sudo apt-get upgrade
|
|
|
|
}
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2013-03-22 18:10:59 -07:00
|
|
|
# vim:set ft=zsh:
|