git » kxd » commit 5c5e005

scripts: Add a configuration for Upstart

author Alberto Bertogli
2014-05-14 23:16:38 UTC
committer Alberto Bertogli
2014-05-14 23:18:39 UTC
parent bf5a15c94ba8eeb43d9b50123ecc6fb98f6b1ba7

scripts: Add a configuration for Upstart

This patch adds a simple configuration for starting kxd using Upstart.

Contributed by Cameron Norman <camerontnorman@gmail.com>.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

Makefile +4 -0
scripts/upstart/kxd.conf +14 -0

diff --git a/Makefile b/Makefile
index 7b0f602..5186d6c 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,10 @@ install-systemd: install-kxd
 	$(INSTALL) -m 0644 scripts/default/kxd $(ETCDIR)/default/kxd
 	$(INSTALL) -m 0644 scripts/systemd/kxd.service $(SYSTEMDDIR)
 
+install-upstart: install-kxd
+	$(INSTALL) -m 0644 scripts/default/kxd $(ETCDIR)/default/kxd
+	$(INSTALL) -m 0644 scripts/upstart/kxd.conf $(ETCDIR)/init/
+
 install-kxc: kxc
 	$(INSTALL) -m 0755 out/kxc $(PREFIX)/bin/
 	$(INSTALL) -m 0755 cryptsetup/kxc-cryptsetup $(PREFIX)/bin/
diff --git a/scripts/upstart/kxd.conf b/scripts/upstart/kxd.conf
new file mode 100644
index 0000000..d5a41eb
--- /dev/null
+++ b/scripts/upstart/kxd.conf
@@ -0,0 +1,14 @@
+description "kxd - Key exchange daemon"
+
+start on filesystem
+stop on runlevel [016]
+
+respawn
+
+pre-start exec test -x /usr/bin/kxd || { stop; exit 0; }
+
+script
+    test ! -r /etc/default/kxd || . /etc/default/kxd
+    exec /usr/bin/kxd $OPTS
+end script
+