Now that onak supports systemd socket activation add the appropriate
systemd service files to enable this on Debian installs. In the longer
term I'd like this to be generic for any distro; patches from people
experienced with them most welcome.
* Development build
* Fix issue with pre-seeding key database on install.
* Development build
* Fix issue with pre-seeding key database on install.
+ * Add systemd service files using new systemd socket activation support.
-- Jonathan McDowell <noodles@earth.li> Sun, 06 Oct 2013 13:18:38 +0100
-- Jonathan McDowell <noodles@earth.li> Sun, 06 Oct 2013 13:18:38 +0100
--- /dev/null
+[Unit]
+Description=Backend caching key daemon for onak OpenPGP keyserver
+Documentation=man:keyd
+Requires=onak.socket
+
+[Service]
+User=onak
+ExecStart=/usr/sbin/keyd -f
+ExecStop=/usr/bin/keydctl quit
--- /dev/null
+[Socket]
+ListenStream=/var/lib/onak/keyd.sock
+SocketUser=onak
+SocketMode=0660
+
+[Install]
+WantedBy=sockets.target
+
+#
+# With the move to systemd this will force systemd to start keyd even if it's
+# disabled in the onak config file; the systemd service file can't check the
+# way the init script does. Work around this by doing the check here and
+# only calling invoke-rc.d if it's actually enabled.
+#
+if grep -q -E '^use_keyd *(true|yes|1)$' /etc/onak.conf; then
+ invoke-rc.d onak start || exit $?
+fi
--- /dev/null
+#! /bin/sh
+
+# If keyd was enabled then make sure to stop it.
+if grep -q -E '^use_keyd *(true|yes|1)$' /etc/onak.conf; then
+ invoke-rc.d onak stop || exit $?
+fi
+
+#DEBHELPER#
- dh "$@" --with autoreconf
+ dh "$@" --with autoreconf,systemd
+
+override_dh_installinit:
+ dh_installinit --no-start
+
+override_dh_systemd_enable:
+ dh_systemd_enable --no-enable debian/onak.service
+ dh_systemd_enable --no-enable debian/onak.socket