Hi,

I have included a small patch to provide a systemd service file and use
dh-systemd for proper installation and activation.

The included keepalived.service is inspired by the ones from Arch Linux
and Fedora and the instructions on the debian wiki on systemd packaging.

I am not sure, if the 'systemd-journald-dev-log.socket' in 'After=' is
really neseccary, but it surely does not hurt.

With this patch I have successfully build a package based on
keepalived_1.2.13-1 from jessie using pbuilder.

If you need any further information, please let me know.

Robert.
diff --git a/debian/control b/debian/control
index 1b7210f..ce5a0e3 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Priority: extra
 Maintainer: Alexander Wirt <[email protected]>
 Build-Depends: autoconf,
                debhelper (>= 9),
+               dh-systemd (>= 1.3),
                libnl-3-dev,
                libnl-genl-3-dev,
                libpopt-dev,
diff --git a/debian/keepalived.service b/debian/keepalived.service
new file mode 100644
index 0000000..dc6540e
--- /dev/null
+++ b/debian/keepalived.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Keepalive Daemon (LVS and VRRP)
+After=network.target
+
+[Service]
+EnvironmentFile=-/etc/default/keepalived
+ExecStart=/usr/sbin/keepalived --dont-fork $DAEMON_ARGS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
index 1c50c13..3a6b488 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,7 +4,7 @@
 #export DH_OPTIONS=-v
 
 %:
-	dh  $@ --with autoreconf
+	dh  $@ --with autoreconf --with=systemd
 
 override_dh_auto_configure:
 	dh_auto_configure -- --with-kernel-dir=debian/  --enable-snmp --enable-sha1
@@ -16,3 +16,8 @@ override_dh_auto_install:
 	rm -rf debian/keepalived/etc/keepalived/keepalived.conf
 	rm -rf debian/keepalived/etc/sysconfig
 	rm -rf debian/keepalived/usr/man
+
+override_dh_systemd_enable:
+	# Do not enable the daemon by default on purpose.
+	# The user should enable it only after making sure the configuration is
+	# appropriate for his/her computer.

Reply via email to