dotfiles/recipes/_apt

23 lines
459 B
Text
Raw Normal View History

2018-02-22 04:15:49 +00:00
#!/bin/bash
2018-02-27 05:15:14 +00:00
set -e
2018-02-22 04:15:49 +00:00
if [ -z "$__apt_updated" ]; then
_run "Update APT cache" sudo apt-get update
__apt_updated=yes
fi
function _apt {
local pkg=$1
if ! dpkg -s $pkg >/dev/null 2>&1; then
_run "[apt] Install $pkg" sudo apt-get install -y $1
else
echo "[apt] $pkg is already installed, skipping."
fi
}
_apt software-properties-common
function _ppa {
_run "[apt] Add PPA: $1" sudo add-apt-repository -u -y ppa:$1
}