#@include core #@include _punani_db ## usage: punani_has PACKAGE punani_has() { eval "_punani_${PACKER}_has \"\$1\"" } ## usage: punani_install PACKAGE punani_install() { eval "_punani_${PACKER}_install \"\$1\"" } ## usage: punani_remove PACKAGE punani_remove() { eval "_punani_${PACKER}_remove \"\$1\"" } ## usage: _punani_resolve_package PKGNAME _punani_resolve_package(){ eval "set -u; echo \"\${_punanidb_${PACKER}_$1}\"" 2>/dev/null } ## usage: _punani_select_packer _punani_select_packer() { for p in ${_punani_known_packers:-null}; do exists $p && info "using $p" && PACKER=`echo $p | tr -d -` && break done } _punani_known_packers='pacman apt-get yum brew' _punani_pacman_install(){ pacman --noconfirm -S --needed "$@" ;} _punani_pacman_remove(){ pacman -Rcs "$@" ;} _punani_pacman_has(){ pacman -Q "$1" >/dev/null;} _punani_aptget_install(){ apt-get -y install "$@" ;} _punani_aptget_remove(){ apt-get -y remove "$@" ;} _punani_aptget_has() { dpkg -s "$1" | grep -q "Status: install";} _punani_yum_install(){ yum -y install "$@" ;} _punani_yum_remove(){ yum -y remove "$@" ;} _punani_yum_has() { rpm -qa --qf "%{NAME}\n"| egrep "^${1}\$" >/dev/null ;} _punani_brew_install(){ brew install "$@"; } _punani_brew_remove(){ brew remove "$@";} # TODO _punani_brew_has