summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@xso>2011-09-01 02:20:34 +0200
committertv <tv@xso>2011-09-01 02:20:34 +0200
commit4fb37da707279faf92cc8a054c646336f23dfdbe (patch)
tree77b9d7bd053486c022d8a128c480646ea9cec728
parent5e7bbf0c4b53a73e3f0bb7e53cbd8bb97c3187cd (diff)
//god/Reaktor/index: initial commit
This wrapper script downloads and configures jsonbot as necessary.
-rw-r--r--.gitignore1
-rwxr-xr-xgod/Reaktor/index36
-rwxr-xr-xgod/Reaktor/lib/listener.py (renamed from god/Reaktor)0
3 files changed, 37 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index ee908b65..2c765648 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ a.out
*.o
*.a
.svn/
+/god/Reaktor/tmp/
/bin/
/node/src
/node/out
diff --git a/god/Reaktor/index b/god/Reaktor/index
new file mode 100755
index 00000000..6470298e
--- /dev/null
+++ b/god/Reaktor/index
@@ -0,0 +1,36 @@
+#! /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
+sed -i '
+ s/^host *=.*/host="'$host'"/
+ s/^passwd *=.*/passwd="'$passwd'"/
+ s/^printto *=.*/printto="'$printto'"/
+' config/udp-send
+
+PYTHONUNBUFFERED=y $listener | tee /dev/stderr | bin/jsb-udp
diff --git a/god/Reaktor b/god/Reaktor/lib/listener.py
index 9708d9bc..9708d9bc 100755
--- a/god/Reaktor
+++ b/god/Reaktor/lib/listener.py