summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/minecproxy.config16
-rw-r--r--debian/minecproxy.postinst28
-rw-r--r--debian/minecproxy.postrm34
-rw-r--r--debian/minecproxy.templates4
4 files changed, 82 insertions, 0 deletions
diff --git a/debian/minecproxy.config b/debian/minecproxy.config
new file mode 100644
index 0000000..9241eda
--- /dev/null
+++ b/debian/minecproxy.config
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+# Query information which is needed once
+query_initial_config() {
+ db_input low minecproxy/purge_database || true
+}
+
+query_initial_config
+
+db_go || true
+
+exit 0
diff --git a/debian/minecproxy.postinst b/debian/minecproxy.postinst
new file mode 100644
index 0000000..de176df
--- /dev/null
+++ b/debian/minecproxy.postinst
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+configure)
+ # Create minecproxy user (if not already done)...
+ adduser --system --group --home /var/lib/minecproxy \
+ --quiet --gecos "Minecraft proxy daemon" minecproxy
+
+ # ...create the directory (could've been removed during a purge
+ # but the user isn't, and adduser won't recreate the dir then)...
+ mkdir /var/lib/minecproxy > /dev/null 2>&1 || true
+
+ # ...change traditional Unix permissions permissions...
+ chown minecproxy:minecproxy /var/lib/minecproxy
+
+ # ...and restore SELinux context.
+ if which restorecon >/dev/null 2>&1; then
+ restorecon /var/lib/minecproxy
+ fi
+
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/minecproxy.postrm b/debian/minecproxy.postrm
new file mode 100644
index 0000000..32e1cd4
--- /dev/null
+++ b/debian/minecproxy.postrm
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if [ -e "/usr/share/debconf/confmodule" ]; then
+ . /usr/share/debconf/confmodule
+fi
+
+# Check if the system-wide Minecraft worlds should be removed on purge
+remove_worlds_on_purge() {
+ db_get minecproxy/purge_database || RET=false
+ if [ "$RET" = "true" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+case "$1" in
+purge)
+ # Don't remove minecproxy user on purge (for now).
+ # See the discussion in Debian bug #621833.
+
+ if remove_worlds_on_purge; then
+ echo -n "Purging Minecraft worlds... "
+ rm -rf /var/lib/minecproxy || true
+ echo done
+ fi
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/minecproxy.templates b/debian/minecproxy.templates
new file mode 100644
index 0000000..eb1314f
--- /dev/null
+++ b/debian/minecproxy.templates
@@ -0,0 +1,4 @@
+Template: minecproxy/purge_database
+Type: boolean
+Default: false
+Description: Do you want Minecraft worlds to be removed when minecproxy is purged?