summaryrefslogtreecommitdiffstats
path: root/ship
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-11-14 13:58:58 +0100
committertv <tv@nomic.retiolum>2013-11-14 13:58:58 +0100
commit7a3fba63f0893565f97f1ff06ff60092e5426988 (patch)
tree4d03a7da2dbb6986ef2aa3f53317bc56516a551e /ship
parent4be2166457e5b55101d55f4c23b9b2a0c6fe6fe3 (diff)
ship punani: lower hierarchy
Diffstat (limited to 'ship')
-rw-r--r--ship/lib/punani38
1 files changed, 19 insertions, 19 deletions
diff --git a/ship/lib/punani b/ship/lib/punani
index 4a8105b6..13413b54 100644
--- a/ship/lib/punani
+++ b/ship/lib/punani
@@ -3,7 +3,7 @@
_punani_usage='punani {install,remove,has} PACKAGE...'
punani(){
- __punani_select_packer || die 'no package manager found; no punani for you!'
+ _punani_select_packer || die 'no package manager found; no punani for you!'
ACTION="$1"; shift
@@ -13,26 +13,26 @@ punani(){
fi
for PKG; do
- RES="`__punani_resolve_package $PKG`" ||
+ RES="`_punani_resolve_package $PKG`" ||
die "could not resolve '$PKG'; no punani for you!"
case "$ACTION" in
install)
- if _punani_has $RES; then
+ if punani_has $RES; then
info "$RES already installed, skipping"
else
- _punani_install $RES || error "cannot install $RES with $PACKER"
+ punani_install $RES || error "cannot install $RES with $PACKER"
fi
;;
remove)
- if ! _punani_has $RES; then
+ if ! punani_has $RES; then
info "$RES not installed, skipping"
else
- _punani_remove $RES || error "cannot install $RES with $PACKER"
+ punani_remove $RES || error "cannot install $RES with $PACKER"
fi
;;
has)
- if _punani_has $RES; then
+ if punani_has $RES; then
info "$RES is installed"
else
info "$RES is not installed"
@@ -45,33 +45,33 @@ punani(){
done
}
-## usage: _punani_has PACKAGE
-_punani_has() {
+## usage: punani_has PACKAGE
+punani_has() {
eval "_punani_${PACKER}_has \"\$1\""
}
-## usage: _punani_install PACKAGE
-_punani_install() {
+## usage: punani_install PACKAGE
+punani_install() {
eval "_punani_${PACKER}_install \"\$1\""
}
-## usage: _punani_remove PACKAGE
-_punani_remove() {
+## usage: punani_remove PACKAGE
+punani_remove() {
eval "_punani_${PACKER}_remove \"\$1\""
}
-## usage: __punani_resolve_package PKGNAME
-__punani_resolve_package(){
+## 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
+## 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_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;}