summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-11-14 14:04:57 +0100
committertv <tv@nomic.retiolum>2013-11-14 14:04:57 +0100
commit36a7b004e2d3bbc3858a6378b3ef19ea3e15f4a1 (patch)
treea392c3e427c73903480c21b3ea2403023f949847
parent7a3fba63f0893565f97f1ff06ff60092e5426988 (diff)
ship punani: mv user interface to src/
-rw-r--r--ship/lib/punani44
-rwxr-xr-xship/src/punani43
2 files changed, 43 insertions, 44 deletions
diff --git a/ship/lib/punani b/ship/lib/punani
index 13413b54..264d1daf 100644
--- a/ship/lib/punani
+++ b/ship/lib/punani
@@ -1,50 +1,6 @@
#@include core
#@include _punani_db
-_punani_usage='punani {install,remove,has} PACKAGE...'
-punani(){
- _punani_select_packer || die 'no package manager found; no punani for you!'
-
- ACTION="$1"; shift
-
- if test $# = 0; then
- error 'no PACKAGE specified.'
- die "usage: $_punani_usage"
- fi
-
- for PKG; do
- RES="`_punani_resolve_package $PKG`" ||
- die "could not resolve '$PKG'; no punani for you!"
-
- case "$ACTION" in
- install)
- if punani_has $RES; then
- info "$RES already installed, skipping"
- else
- punani_install $RES || error "cannot install $RES with $PACKER"
- fi
- ;;
- remove)
- if ! punani_has $RES; then
- info "$RES not installed, skipping"
- else
- punani_remove $RES || error "cannot install $RES with $PACKER"
- fi
- ;;
- has)
- if punani_has $RES; then
- info "$RES is installed"
- else
- info "$RES is not installed"
- fi
- ;;
- *)
- error "bad action: $ACTION"
- die "usage: $_punani_usage"
- esac
- done
-}
-
## usage: punani_has PACKAGE
punani_has() {
eval "_punani_${PACKER}_has \"\$1\""
diff --git a/ship/src/punani b/ship/src/punani
index ceabd667..61043bc0 100755
--- a/ship/src/punani
+++ b/ship/src/punani
@@ -1,4 +1,47 @@
#! /bin/sh
#@info
#@include punani
+punani(){
+ _punani_usage='punani {install,remove,has} PACKAGE...'
+ _punani_select_packer || die 'no package manager found; no punani for you!'
+
+ ACTION="$1"; shift
+
+ if test $# = 0; then
+ error 'no PACKAGE specified.'
+ die "usage: $_punani_usage"
+ fi
+
+ for PKG; do
+ RES="`_punani_resolve_package $PKG`" ||
+ die "could not resolve '$PKG'; no punani for you!"
+
+ case "$ACTION" in
+ install)
+ if punani_has $RES; then
+ info "$RES already installed, skipping"
+ else
+ punani_install $RES || error "cannot install $RES with $PACKER"
+ fi
+ ;;
+ remove)
+ if ! punani_has $RES; then
+ info "$RES not installed, skipping"
+ else
+ punani_remove $RES || error "cannot install $RES with $PACKER"
+ fi
+ ;;
+ has)
+ if punani_has $RES; then
+ info "$RES is installed"
+ else
+ info "$RES is not installed"
+ fi
+ ;;
+ *)
+ error "bad action: $ACTION"
+ die "usage: $_punani_usage"
+ esac
+ done
+}
punani "$@"