Skip to content

Commit 12b52cc

Browse files
Sergej Pupykinpjstevns
Sergej Pupykin
authored andcommitted
add systemd support
This patch adds .service files and tmpfiles.d. Signed-off-by: Paul J Stevens <[email protected]>
1 parent 79287f4 commit 12b52cc

8 files changed

+122
-2
lines changed

Makefile.am

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ if MANPAGES
66
SUBDIRS += man
77
endif
88

9-
9+
if SYSTEMD
10+
SUBDIRS += systemd
11+
endif

configure.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ AC_ARG_ENABLE([manpages],
4444
AS_HELP_STRING([--enable-manpages], [Enable building and installation of man pages]))
4545
AM_CONDITIONAL(MANPAGES, [ test "$enable_manpages" = "yes" ])
4646

47+
AC_ARG_ENABLE([systemd],
48+
AS_HELP_STRING([--enable-systemd], [Enable systemd support]))
49+
AM_CONDITIONAL(SYSTEMD, [ test "$enable_systemd" = "yes" ])
50+
4751
AC_PROG_CC
4852
AC_COMPILE_WARNINGS
4953
AC_C_CONST
@@ -80,6 +84,6 @@ AC_SUBST(DM_PKGLIBDIR)
8084
AC_SUBST(DM_PWD)
8185
AC_PROG_LIBTOOL
8286

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

8589
DM_MSG_CONFIGURE_RESULTS

systemd/Makefile.am

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright (C) 1999-2004 IC & S [email protected]
2+
# Copyright (c) 2004-2011 NFG Net Facilities Group BV [email protected]
3+
#
4+
# This program is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU General Public License
6+
# as published by the Free Software Foundation; either
7+
# version 2 of the License, or (at your option) any later
8+
# version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, write to the Free Software
17+
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18+
19+
20+
EXTRA_DIST = dbmail-imapd.service.in dbmail-lmtpd.service.in dbmail-pop3d.service.in dbmail-timsieved.service.in
21+
SYSTEMD_UNIT_DIR = /usr/lib/systemd/system
22+
SYSTEMD_TMPFILES_DIR = /usr/lib/tmpfiles.d
23+
PID_DIR=/run/dbmail
24+
25+
if SYSTEMD
26+
install-systemd: dbmail-imapd.service dbmail-lmtpd.service dbmail-pop3d.service dbmail-timsieved.service dbmail.tmpfiles
27+
$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
28+
$(INSTALL_DATA) dbmail-imapd.service \
29+
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-imapd.service
30+
$(INSTALL_DATA) dbmail-lmtpd.service \
31+
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-lmtpd.service
32+
$(INSTALL_DATA) dbmail-pop3d.service \
33+
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-pop3d.service
34+
$(INSTALL_DATA) dbmail-timsieved.service \
35+
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-timsieved.service
36+
$(MKDIR_P) $(DESTDIR)$(SYSTEMD_TMPFILES_DIR)
37+
$(INSTALL_DATA) dbmail.tmpfiles \
38+
$(DESTDIR)$(SYSTEMD_TMPFILES_DIR)/dbmail.conf
39+
40+
uninstall-systemd:
41+
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-imapd.service
42+
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-lmtpd.service
43+
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-pop3d.service
44+
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/dbmail-timsieved.service
45+
rm -f $(DESTDIR)$(SYSTEMD_TMPFILES_DIR)/dbmail.tmpfiles
46+
rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
47+
48+
SUFFIXES=.service.in .service .tmpfiles.in .tmpfiles
49+
50+
.service.in.service:
51+
$(AM_V_GEN)sed \
52+
-e 's|[@]sbindir[@]|$(sbindir)|g' \
53+
-e 's|[@]piddir[@]|$(PID_DIR)|g' \
54+
< $< > $@-t && \
55+
mv $@-t $@
56+
57+
.tmpfiles.in.tmpfiles:
58+
$(AM_V_GEN)sed \
59+
-e 's|[@]piddir[@]|$(PID_DIR)|g' \
60+
< $< > $@-t && \
61+
mv $@-t $@
62+
63+
else
64+
install-systemd:
65+
uninstall-systemd:
66+
endif
67+
68+
install-data-local: install-systemd
69+
uninstall-local: uninstall-systemd

systemd/dbmail-imapd.service.in

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=DBMail Imap Server
3+
After=syslog.target network.target mysqld.service postgresql.service
4+
5+
[Service]
6+
Type=forking
7+
PIDFile=@piddir@/dbmail-imapd.pid
8+
ExecStart=@sbindir@/dbmail-imapd -p @piddir@/dbmail-imapd.pid
9+
10+
[Install]
11+
WantedBy=multi-user.target

systemd/dbmail-lmtpd.service.in

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=DBMail LMTP Server
3+
After=syslog.target network.target mysqld.service postgresql.service
4+
5+
[Service]
6+
Type=forking
7+
PIDFile=@piddir@/dbmail-lmtpd.pid
8+
ExecStart=@sbindir@/dbmail-lmtpd -p @piddir@/dbmail-lmtpd.pid
9+
10+
[Install]
11+
WantedBy=multi-user.target

systemd/dbmail-pop3d.service.in

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=DBMail pop3 Server
3+
After=syslog.target network.target mysqld.service postgresql.service
4+
5+
[Service]
6+
Type=forking
7+
PIDFile=@piddir@/dbmail-pop3d.pid
8+
ExecStart=@sbindir@/dbmail-pop3d -p @piddir@/dbmail-pop3d.pid
9+
10+
[Install]
11+
WantedBy=multi-user.target

systemd/dbmail-timsieved.service.in

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=DBMail Sieve Server
3+
After=syslog.target network.target mysqld.service postgresql.service
4+
5+
[Service]
6+
Type=forking
7+
PIDFile=@piddir@/dbmail-timsieved.pid
8+
ExecStart=@sbindir@/dbmail-timsieved -p @piddir@/dbmail-timsieved.pid
9+
10+
[Install]
11+
WantedBy=multi-user.target

systemd/dbmail.tmpfiles.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d @piddir@ 0755 nobody nobody -

0 commit comments

Comments
 (0)