From f5c086a61ed2cf493d2e6edb0edf0f32230bb615 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 16 Nov 2011 19:29:44 +0100 Subject: //punani/tightnani_client: initial commit the tigtnani client finds your package manager and the required parameters to handle the manager. currently it is able to remove and install : pacman (and derivates), apt (and derivates), yum and brew. Nothing is tested so be aware --- punani/tightnani/tightnani_client | 59 +++++++++++++++++++++++++++++++++++++++ punani/tightnani/tightnani_db | 6 +++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100755 punani/tightnani/tightnani_client (limited to 'punani') diff --git a/punani/tightnani/tightnani_client b/punani/tightnani/tightnani_client new file mode 100755 index 00000000..d2a598d3 --- /dev/null +++ b/punani/tightnani/tightnani_client @@ -0,0 +1,59 @@ +#!/bin/bash +set -xeuf + +if [ $# -ne 2 ];then + echo "usage: `basename $0` (install|remove) PACKAGE" + exit 23 +fi + +PACKERS="yum!-y install remove +brew install remove +pacman!--noconfirm -S!--needed -Rcs +bauerbill!--noconfirm -S!--needed -Rcs +yaourt!--noconfirm -S!--needed -Rcs +packer!--noconfirm -S!--needed -Rcs +apt-get!--yes install remove +aptitude!--yes install remove" + +OIFS=$IFS +PACKER= +IFS=' +' + +TIGHTNANI_HOST="http://euer.krebsco.de:9111" +# Find suitable packer +for PACKER_LINE in $PACKERS; do + TRY_PACKER_CMD="$(echo "$PACKER_LINE" | cut -d ' ' -f 1)" + TRY_PACKER="$(echo "$TRY_PACKER_CMD" | cut -d '!' -f 1)" + if which $TRY_PACKER &>/dev/null; then + PACKER=$TRY_PACKER + PACKER_CMD="$(echo "$TRY_PACKER_CMD" | tr "!" " ")" + echo "you got $PACKER" + INSTALL_PARAM="$(echo "$PACKER_LINE" | cut -d ' ' -f 2 | tr "!" " ")" + REMOVE_PARAM="$(echo "$PACKER_LINE" | cut -d ' ' -f 3 | tr "!" " ")" + fi +done +IFS=$OIFS +if [ ! "$PACKER" ];then + echo "Could not find a supported packer for you, bailing out!" + exit 23 +fi + + +# find the package name +PKG="$2" +RESOLVED=`wget -O- $TIGHTNANI_HOST/$PACKER/$PKG` +if [ ! "$RESOLVED" ];then + echo "Could not resolve your requested package, bailing out!" + exit 23 +fi +case "$1" in + install) + exec $PACKER_CMD $INSTALL_PARAM $RESOLVED + ;; + remove) + exec $PACKER_CMD $REMOVE_PARAM $RESOLVED + ;; + *) + echo "usage: `basename $0` (install|remove) PACKAGE" +esac diff --git a/punani/tightnani/tightnani_db b/punani/tightnani/tightnani_db index d15a9ad4..322e28f8 100644 --- a/punani/tightnani/tightnani_db +++ b/punani/tightnani/tightnani_db @@ -21,5 +21,9 @@ "python3" : { "apt-get" : "python3", "pacman" : "python" - } + }, + "tinc" : { + "apt-get" : "tinc", + "yaourt" : "tinc" + } } -- cgit v1.2.3 From 655db45a3ef4ca58f9e9fe42bba015d1fd1eccb6 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 16 Nov 2011 19:34:09 +0100 Subject: //punani: tightnani is now less verbose --- punani/tightnani/tightnani_client | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'punani') diff --git a/punani/tightnani/tightnani_client b/punani/tightnani/tightnani_client index d2a598d3..8caf669e 100755 --- a/punani/tightnani/tightnani_client +++ b/punani/tightnani/tightnani_client @@ -1,5 +1,5 @@ #!/bin/bash -set -xeuf +set -euf if [ $# -ne 2 ];then echo "usage: `basename $0` (install|remove) PACKAGE" @@ -42,7 +42,7 @@ fi # find the package name PKG="$2" -RESOLVED=`wget -O- $TIGHTNANI_HOST/$PACKER/$PKG` +RESOLVED=`wget -O- $TIGHTNANI_HOST/$PACKER/$PKG 2>/dev/null` if [ ! "$RESOLVED" ];then echo "Could not resolve your requested package, bailing out!" exit 23 -- cgit v1.2.3