From a2a2622367fed4490c1ad43bfc2ebf03550810b5 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Tue, 5 Jan 2016 22:16:03 +0100
Subject: debian package fixes and improvments


diff --git a/debian/changelog b/debian/changelog
index 39ebab3..83462d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+rhimportd (0.1-2) unstable; urgency=medium
+
+  * fixed path to environment file
+  * added prepartion script for systemd unit which creates directories
+
+ -- Christian Pointner <equinox@spreadspace.org>  Tue, 05 Jan 2016 22:14:26 +0100
+
 rhimportd (0.1-1) unstable; urgency=medium
 
   * Initial release.
diff --git a/debian/install b/debian/install
index 4ee774d..5140a73 100644
--- a/debian/install
+++ b/debian/install
@@ -1,2 +1,3 @@
-etc/rhimportd.conf
 usr/bin/rhimportd
+usr/bin/rhimportd.pre
+etc/rhimportd.conf
diff --git a/debian/rhimportd.conf b/debian/rhimportd.conf
index 37bd091..6b7d420 100644
--- a/debian/rhimportd.conf
+++ b/debian/rhimportd.conf
@@ -1,7 +1,12 @@
+#TELGO_DEBUG=1
+#RHIMPORT_DEBUG=1
+#RHIMPORTD_DEBUG=1
+
 RHIMPORTD_RD_CONF=/etc/rd.conf
 RHIMPORTD_RDXPORT_URL=http://localhost/rd-bin/rdxport.cgi
 RHIMPORTD_TEMP_DIR=/var/lib/rhimportd/tmp
 RHIMPORTD_LOCAL_FETCH_DIR=/var/lib/rhimportd/local
+
 RHIMPORTD_WATCH_DIR=/var/lib/rhimportd/watch
 RHIMPORTD_WEB_ADDR=localhost:4080
 RHIMPORTD_TELNET_ADDR=""
diff --git a/debian/rhimportd.pre b/debian/rhimportd.pre
new file mode 100644
index 0000000..8610c85
--- /dev/null
+++ b/debian/rhimportd.pre
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# create some directories needed by rhimportd
+# this would normally be done by the initscript.
+#
+
+if [ -n "$RHIMPORTD_TEMP_DIR" ]; then
+  mkdir -m 775 -p "$RHIMPORTD_TEMP_DIR"
+fi
+
+if [ -n "$RHIMPORTD_LOCAL_FETCH_DIR" ]; then
+  mkdir -m 775 -p "$RHIMPORTD_LOCAL_FETCH_DIR"
+fi
+
+if [ -n "$RHIMPORTD_WATCH_DIR" ]; then
+  mkdir -m 775 -p "$RHIMPORTD_WATCH_DIR"
+fi
+
+exit 0
diff --git a/debian/rhimportd.service b/debian/rhimportd.service
index 65acc5d..c930976 100644
--- a/debian/rhimportd.service
+++ b/debian/rhimportd.service
@@ -5,6 +5,7 @@ Description=Radio Helsinki Rivendell Import Daemon
 User=rhimportd
 Group=rhimportd
 EnvironmentFile=/etc/rhimportd.conf
+ExecStartPre=/usr/bin/rhimportd.pre
 ExecStart=/usr/bin/rhimportd
 Restart=always
 RestartSec=1s
diff --git a/debian/rules b/debian/rules
index 00fe9d3..dd4e9ea 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,5 +13,6 @@ override_dh_auto_clean:
 override_dh_auto_install:
 	install -d $$(pwd)/debian/tmp/usr/bin/
 	install -m 755 $$(pwd)/bin/rhimportd $$(pwd)/debian/tmp/usr/bin/
+	install -m 755 $$(pwd)/debian/rhimportd.pre $$(pwd)/debian/tmp/usr/bin/
 	install -d $$(pwd)/debian/tmp/etc/
 	install -m 644 $$(pwd)/debian/rhimportd.conf $$(pwd)/debian/tmp/etc/
-- 
cgit v0.10.2