summaryrefslogtreecommitdiffstats
path: root/god/Reaktor/index
blob: 6715eeda008ef172bd7f5a196fa17dee967dd192 (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
#! /bin/sh
#
# //god/Reaktor - listen to UDP events and forward them to IRC
#
# export host passwd printto to configure jsb-udp
#
set -euf
cd $(readlink -f $(dirname $0))

listener=$(readlink -f lib/listener.py)

jsb_version=0.7.1.2
distdir=jsb-$jsb_version.tar.gz

host=${host-91.206.142.247}
passwd=${passwd-h4x0r}
printto=${printto-#shackspace}

if ! test -x tmp/jsb-$jsb_version; then
  mkdir -p tmp
  cd tmp
  curl -f http://jsonbot.googlecode.com/files/jsb-$jsb_version.tar.gz | tar zx
  cd jsb-$jsb_version
  bin/jsb-udp -s </dev/null
  cd ../..
fi
cd tmp/jsb-$jsb_version

# TODO only if it is not already configured properly
cache="`cat config/udp-send`"
echo "$cache" |
sed '
  s/^host *=.*/host="'$host'"/
  s/^passwd *=.*/passwd="'$passwd'"/
  s/^printto *=.*/printto="'$printto'"/
' > config/udp-send

# TODO output modules: stderr, jsb-udp, remount-ro, ...
PYTHONUNBUFFERED=y $listener | tee /dev/stderr | bin/jsb-udp