Mailing List Archive

[PATCH] add systemd support
This patch adds .service files and tmpfiles.d.

---
Makefile.am | 4 ++-
configure.in | 6 +++-
systemd/Makefile.am | 69 +++++++++++++++++++++++++++++++++++++
systemd/dbmail-imapd.service.in | 11 ++++++
systemd/dbmail-lmtpd.service.in | 11 ++++++
systemd/dbmail-pop3d.service.in | 11 ++++++
systemd/dbmail-timsieved.service.in | 11 ++++++
systemd/dbmail.tmpfiles.in | 1 +
8 files changed, 122 insertions(+), 2 deletions(-)
create mode 100644 systemd/Makefile.am
create mode 100644 systemd/dbmail-imapd.service.in
create mode 100644 systemd/dbmail-lmtpd.service.in
create mode 100644 systemd/dbmail-pop3d.service.in
create mode 100644 systemd/dbmail-timsieved.service.in
create mode 100644 systemd/dbmail.tmpfiles.in

diff --git a/Makefile.am b/Makefile.am
index 49a63eb..3cb330e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,4 +6,6 @@ if MANPAGES
SUBDIRS += man
endif

-
+if SYSTEMD
+SUBDIRS += systemd
+endif
diff --git a/configure.in b/configure.in
index fd5324d..1c51f98 100644
--- a/configure.in
+++ b/configure.in
@@ -44,6 +44,10 @@ AC_ARG_ENABLE([manpages],
AS_HELP_STRING([--enable-manpages], [Enable building and installation of man pages]))
AM_CONDITIONAL(MANPAGES, [ test "$enable_manpages" = "yes" ])

+AC_ARG_ENABLE([systemd],
+ AS_HELP_STRING([--enable-systemd], [Enable systemd support]))
+AM_CONDITIONAL(SYSTEMD, [ test "$enable_systemd" = "yes" ])
+
AC_PROG_CC
AC_COMPILE_WARNINGS
AC_C_CONST
@@ -80,6 +84,6 @@ AC_SUBST(DM_PKGLIBDIR)
AC_SUBST(DM_PWD)
AC_PROG_LIBTOOL

-AC_OUTPUT(src/dbmail.h Makefile src/Makefile src/modules/Makefile man/Makefile test/Makefile)
+AC_OUTPUT(src/dbmail.h Makefile src/Makefile src/modules/Makefile man/Makefile test/Makefile systemd/Makefile)

DM_MSG_CONFIGURE_RESULTS
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
new file mode 100644
index 0000000..004c04a
--- /dev/null
+++ b/systemd/Makefile.am
@@ -0,0 +1,69 @@
+# Copyright (C) 1999-2004 IC & S dbmail@ic-s.nl
+# Copyright (c) 2004-2011 NFG Net Facilities Group BV support@nfg.nl
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+EXTRA_DIST = dbmail-imapd.service.in dbmail-lmtpd.service.in dbmail-pop3d.service.in dbmail-timsieved.service.in
+SYSTEMD_UNIT_DIR = /usr/lib/systemd/system
+SYSTEMD_TMPFILES_DIR = /usr/lib/tmpfiles.d
+PID_DIR=/run/dbmail
+
+if SYSTEMD
+install-systemd: dbmail-imapd.service dbmail-lmtpd.service dbmail-pop3d.service dbmail-timsieved.service dbmail.tmpfiles
+ $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
+ $(INSTALL_DATA) dbmail-imapd.service \
+ $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-imapd.service
+ $(INSTALL_DATA) dbmail-lmtpd.service \
+ $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-lmtpd.service
+ $(INSTALL_DATA) dbmail-pop3d.service \
+ $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-pop3d.service
+ $(INSTALL_DATA) dbmail-timsieved.service \
+ $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-timsieved.service
+ $(MKDIR_P) $(DESTDIR)$(SYSTEMD_TMPFILES_DIR)
+ $(INSTALL_DATA) dbmail.tmpfiles \
+ $(DESTDIR)$(SYSTEMD_TMPFILES_DIR)/dbmail.conf
+
+uninstall-systemd:
+ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-imapd.service
+ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-lmtpd.service
+ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-pop3d.service
+ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-timsieved.service
+ rm -f $(DESTDIR)$(SYSTEMD_TMPFILES_DIR)/dbmail.tmpfiles
+ rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
+
+SUFFIXES=.service.in .service .tmpfiles.in .tmpfiles
+
+.service.in.service:
+ $(AM_V_GEN)sed \
+ -e 's|[@]sbindir[@]|$(sbindir)|g' \
+ -e 's|[@]piddir[@]|$(PID_DIR)|g' \
+ < $< > $@-t && \
+ mv $@-t $@
+
+.tmpfiles.in.tmpfiles:
+ $(AM_V_GEN)sed \
+ -e 's|[@]piddir[@]|$(PID_DIR)|g' \
+ < $< > $@-t && \
+ mv $@-t $@
+
+else
+install-systemd:
+uninstall-systemd:
+endif
+
+install-data-local: install-systemd
+uninstall-local: uninstall-systemd
diff --git a/systemd/dbmail-imapd.service.in b/systemd/dbmail-imapd.service.in
new file mode 100644
index 0000000..70f6b06
--- /dev/null
+++ b/systemd/dbmail-imapd.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail Imap Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=@piddir@/dbmail-imapd.pid
+ExecStart=@sbindir@/dbmail-imapd -p @piddir@/dbmail-imapd.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/dbmail-lmtpd.service.in b/systemd/dbmail-lmtpd.service.in
new file mode 100644
index 0000000..364471b
--- /dev/null
+++ b/systemd/dbmail-lmtpd.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail LMTP Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=@piddir@/dbmail-lmtpd.pid
+ExecStart=@sbindir@/dbmail-lmtpd -p @piddir@/dbmail-lmtpd.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/dbmail-pop3d.service.in b/systemd/dbmail-pop3d.service.in
new file mode 100644
index 0000000..939c0a3
--- /dev/null
+++ b/systemd/dbmail-pop3d.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail pop3 Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=@piddir@/dbmail-pop3d.pid
+ExecStart=@sbindir@/dbmail-pop3d -p @piddir@/dbmail-pop3d.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/dbmail-timsieved.service.in b/systemd/dbmail-timsieved.service.in
new file mode 100644
index 0000000..24dee44
--- /dev/null
+++ b/systemd/dbmail-timsieved.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail Sieve Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=@piddir@/dbmail-timsieved.pid
+ExecStart=@sbindir@/dbmail-timsieved -p @piddir@/dbmail-timsieved.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/dbmail.tmpfiles.in b/systemd/dbmail.tmpfiles.in
new file mode 100644
index 0000000..c847422
--- /dev/null
+++ b/systemd/dbmail.tmpfiles.in
@@ -0,0 +1 @@
+d @piddir@ 0755 nobody nobody -
--
1.8.4
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev
Re: [PATCH] add systemd support [ In reply to ]
I am not familar with autotools, libvirt implementation was used as a
base.

Patch does not contain files that can be generated (configure,
Makefile.in)

At Wed, 04 Sep 2013 21:15:05 +0400,
Sergej Pupykin <ml@sergej.pp.ru> wrote:
>
> This patch adds .service files and tmpfiles.d.
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev