From 8d31bf8340ba7c9492883403229ebc6ab4893d64 Mon Sep 17 00:00:00 2001
From: Paul <paul@zom.bi>
Date: Sat, 8 Dec 2018 13:50:44 +0100
Subject: [PATCH] Initial commit

---
 Dockerfile   | 18 ++++++++++++++++++
 README.md    | 23 +++++++++++++++++++++++
 bin/start.sh | 25 +++++++++++++++++++++++++
 3 files changed, 66 insertions(+)
 create mode 100644 Dockerfile
 create mode 100644 README.md
 create mode 100644 bin/start.sh

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2d321fd
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,18 @@
+FROM debian:stretch
+MAINTAINER none
+
+RUN \
+    apt-get update \
+    && apt-get install --yes python git python-pip libssl-dev libbz2-dev \
+		&& apt-get clean \
+		&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
+        && pip install zeroc-ice
+
+ADD bin/start.sh /tmp/start.sh
+RUN chmod 755 /tmp/start.sh
+VOLUME ["/data"]
+
+RUN git clone https://github.com/mumble-voip/mumo.git
+
+WORKDIR /mumo
+CMD ["/tmp/start.sh"]
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9c7719d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,23 @@
+## Mumble-moderator ("mumo")
+Mumble Moderator is a python interface to moderate Mumble
+
+### Building mumo
+
+```
+docker build -t zombi/mumble-moderator .
+```
+
+### Running the mumo
+Mumo needs to attach to a running mumble server, in order to work properly.
+We usually do this by directly attaching the networks of both containers to
+each other, like this:
+
+```
+   docker run -d \
+    --name mumo \
+    -v /data/mumo:/data \
+    -v /etc/localtime:/etc/localtime:ro \
+    --net="container:mumble" \
+    zombi/mumo
+```
+
diff --git a/bin/start.sh b/bin/start.sh
new file mode 100644
index 0000000..1f10c39
--- /dev/null
+++ b/bin/start.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+if [ ! -f /data/mumo.ini ]
+then
+  cp /mumo/mumo.ini /data
+
+  sed -i 's/mumo.log/\/data\/mumo.log/' /data/mumo.ini
+  sed -i 's/modules\//\/data\/modules\//' /data/mumo.ini
+  sed -i 's/modules-enabled\//\/data\/modules-enabled\//' /data/mumo.ini
+
+  chmod a+rw /data/mumo.ini
+  cp -r /mumo/modules-available /data
+  mkdir -p /data/modules-enabled
+
+  echo Created mumo default config data. Exiting.
+  exit 1
+fi
+
+# Mumo apparently refuses to read config from mounted dirs,
+# so we copy them ...
+cp -r /data/mumo.ini /mumo
+cp -r /data/modules /mumo # TODO: Add from git
+cp -r /data/modules-available /mumo
+cp -r /data/modules-enabled /mumo
+exec /mumo/mumo.py