]> git.pld-linux.org Git - packages/opensmtpd.git/blob - opensmtpd.spec
macro for privsepdir
[packages/opensmtpd.git] / opensmtpd.spec
1 # TODO
2 # - allocate uid/gid
3 # - should mailq and newalises be in bindir?
4
5 # Conditional build:
6 %bcond_without  pam             # build without PAM support
7
8 %define rel     0.1
9 %define prerelease      201310231634
10 Summary:        Free implementation of the server-side SMTP protocol as defined by RFC 5321
11 Name:           opensmtpd
12 Version:        5.3.3p1
13 Release:        0.%{prerelease}.%{rel}
14 License:        ISC
15 Group:          Daemons
16 #Source0:       http://www.opensmtpd.org/archives/%{name}-%{version}.tar.gz
17 Source0:        http://www.opensmtpd.org/archives/%{name}-%{prerelease}p1.tar.gz
18 # Source0-md5:  d4c28a45527356fbec19853220e3688d
19 Source1:        %{name}.service
20 Source2:        %{name}.init
21 Source3:        %{name}.pam
22 URL:            http://www.opensmtpd.org/
23 BuildRequires:  automake
24 BuildRequires:  bison
25 BuildRequires:  db-devel
26 BuildRequires:  libevent-devel
27 BuildRequires:  libtool
28 BuildRequires:  openssl-devel
29 %{?with_pam:BuildRequires:      pam-devel}
30 BuildRequires:  rpmbuild(macros) >= 1.228
31 Requires(post,preun):   /sbin/chkconfig
32 Requires:       rc-scripts
33 Provides:       smtpdaemon
34 Obsoletes:      smtpdaemon
35 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36
37 %define         _privsepdir     /usr/share/empty
38
39 %description
40 OpenSMTPD is a FREE implementation of the server-side SMTP protocol as
41 defined by RFC 5321, with some additional standard extensions. It
42 allows ordinary machines to exchange e-mails with other systems
43 speaking the SMTP protocol.
44
45 Started out of dissatisfaction with other implementations, OpenSMTPD
46 nowadays is a fairly complete SMTP implementation. OpenSMTPD is
47 primarily developed by Gilles Chehade, Eric Faurot and Charles
48 Longeau; with contributions from various OpenBSD hackers. OpenSMTPD is
49 part of the OpenBSD Project. The software is freely usable and
50 re-usable by everyone under an ISC license.
51
52 %prep
53 %setup -q %{?prerelease: -n %{name}-%{prerelease}p1}
54
55 %build
56 # db4 paths
57 CFLAGS="$CFLAGS -I%{_includedir}/libdb4"
58 LDFLAGS="$LDFLAGS -L%{_libdir}/libdb4"
59
60 %configure \
61         --sysconfdir=%{_sysconfdir}/mail \
62         --libexecdir=%{_libdir}/%{name} \
63         --with-mantype=man \
64         %{?with_pam:--with-pam} \
65         --with-privsep-user=smtpd \
66         --with-queue-user=smtpq \
67         --with-privsep-path=%{_privsepdir} \
68         --with-sock-dir=%{_localstatedir}/run
69
70 %{__make}
71
72 %install
73 rm -rf $RPM_BUILD_ROOT
74 %{__make} install \
75         DESTDIR=$RPM_BUILD_ROOT
76
77 install -d $RPM_BUILD_ROOT{%{systemdunitdir},/etc/{rc.d/init.d,pam.d}}
78 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/opensmtpd.service
79 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/opensmtpd
80 %if %{with pam}
81 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/smtp
82 %endif
83
84 # /usr/sbin/sendmail compatibility is not required /usr/lib/sendmail is
85 install -d $RPM_BUILD_ROOT%{_prefix}/lib
86 mv $RPM_BUILD_ROOT{%{_bindir},%{_prefix}/lib}/sendmail
87
88 %clean
89 rm -rf $RPM_BUILD_ROOT
90
91 %pre
92 %if 0
93 %groupadd -r smtpd
94 %groupadd -r smtpq
95 %useradd -r -g smtpd -s /sbin/nologin -c "OpenSMTPd privsep user" -d /usr/share/empty smtpd
96 %useradd -r -g smtpq -s /sbin/nologin -c "OpenSMTPd queue user" -d /usr/share/empty smtpq
97 %endif
98
99 %post
100 /sbin/chkconfig --add %{name}
101 %service %{name} restart
102 %systemd_post %{name}.service
103
104 %preun
105 if [ $1 = 0 ]; then
106         %service %{name} stop
107         /sbin/chkconfig --del %{name}
108 fi
109 %systemd_preun %{name}.service
110
111 %postun
112 %systemd_reload
113
114 %files
115 %defattr(644,root,root,755)
116 %doc LICENSE README.md THANKS
117 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mail/smtpd.conf
118 %if %{with pam}
119 %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/smtp
120 %endif
121 %attr(754,root,root) /etc/rc.d/init.d/opensmtpd
122 %{systemdunitdir}/%{name}.service
123 %attr(755,root,root) %{_sbindir}/mailq
124 %attr(755,root,root) %{_sbindir}/makemap
125 %attr(755,root,root) %{_sbindir}/newaliases
126 %attr(755,root,root) %{_sbindir}/smtpctl
127 %attr(755,root,root) %{_sbindir}/smtpd
128 %attr(755,root,root) %{_prefix}/lib/sendmail
129 %{_mandir}/man5/aliases.5*
130 %{_mandir}/man5/forward.5*
131 %{_mandir}/man5/smtpd.conf.5*
132 %{_mandir}/man5/table.5*
133 %{_mandir}/man8/makemap.8*
134 %{_mandir}/man8/newaliases.8*
135 %{_mandir}/man8/sendmail.8*
136 %{_mandir}/man8/smtpctl.8*
137 %{_mandir}/man8/smtpd.8*
138 %dir %{_libdir}/%{name}
139 %dir %{_libdir}/%{name}/smtpd
140 %attr(755,root,root) %{_libdir}/%{name}/smtpd/backend-queue-null
141 %attr(755,root,root) %{_libdir}/%{name}/smtpd/backend-queue-ram
142 %attr(755,root,root) %{_libdir}/%{name}/smtpd/backend-queue-stub
143 %attr(755,root,root) %{_libdir}/%{name}/smtpd/backend-scheduler-ram
144 %attr(755,root,root) %{_libdir}/%{name}/smtpd/backend-scheduler-stub
145 %attr(755,root,root) %{_libdir}/%{name}/smtpd/filter-dnsbl
146 %attr(755,root,root) %{_libdir}/%{name}/smtpd/filter-monkey
147 %attr(755,root,root) %{_libdir}/%{name}/smtpd/filter-stub
148 %attr(755,root,root) %{_libdir}/%{name}/smtpd/filter-trace
149 %attr(755,root,root) %{_libdir}/%{name}/smtpd/mail.local
150 %attr(755,root,root) %{_libdir}/%{name}/smtpd/table-passwd
151 %attr(755,root,root) %{_libdir}/%{name}/smtpd/table-stub
This page took 0.098896 seconds and 4 git commands to generate.