blob: d2a598d312847144cfac13bc1ff2f8d5013ef360 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
|