diff options
Diffstat (limited to 'ship/lib')
-rw-r--r-- | ship/lib/_punani_db | 12 | ||||
-rw-r--r-- | ship/lib/core | 11 | ||||
-rw-r--r-- | ship/lib/punani | 48 |
3 files changed, 65 insertions, 6 deletions
diff --git a/ship/lib/_punani_db b/ship/lib/_punani_db index 9812aff7..721b5fa2 100644 --- a/ship/lib/_punani_db +++ b/ship/lib/_punani_db @@ -13,6 +13,18 @@ _punanidb_aptget_python2=python _punanidb_pacman_python3=python _punanidb_aptget_python3=python3 +_punanidb_pacman_pip2=python2-pip +_punanidb_aptget_pip2=python-pip + +_punanidb_pacman_virtualenv=python-virtualenv +_punanidb_aptget_virtualenv=python-virtualenv + +_punanidb_pacman_gpp=g++ +_punanidb_aptget_gpp=gcc + +_punanidb_pacman_python2_dev=python2 +_punanidb_aptget_python2_dev=python-dev + _punanidb_pacman_hostname=inetutils _punanidb_aptget_hostname=hostname diff --git a/ship/lib/core b/ship/lib/core index d6e01352..6ae87fa4 100644 --- a/ship/lib/core +++ b/ship/lib/core @@ -22,12 +22,11 @@ defer(){ } esudo(){ - # becomes root with sudo powers - # unless nosudo env is set - if test "${nosudo-false}" != true && ! is_root; then - echo "we're going sudo..." >&2 - exec sudo -E "$0" "$@" - exit 23 # go to hell + # weaksauce esudo, bail out if we are not root + if ! is_root; then + # for the records: + # exec sudo -E "$0" "$@" + die "You are not root enough to run this script" 2>&1 fi } diff --git a/ship/lib/punani b/ship/lib/punani index 34307c42..ea05a4ec 100644 --- a/ship/lib/punani +++ b/ship/lib/punani @@ -48,3 +48,51 @@ _punani_yum_owner(){ rpm -qf "$1" ;} _punani_brew_install(){ brew install "$@"; } _punani_brew_remove(){ brew remove "$@";} # TODO _punani_brew_has + +punani(){ + # punani UI + _punani_usage='punani {install,remove,has,owner} 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 + ;; + owner) + punani_owner $RES + ;; + *) + error "bad action: $ACTION" + die "usage: $_punani_usage" + esac + done +} |