Commit | Line | Data |
---|---|---|
d9898ee8 | 1 | # |
0e333c05 | 2 | # Copyright 1998 - 2017 Double Precision, Inc. See COPYING for |
d9898ee8 | 3 | # distribution information. |
4 | ||
5 | # No dist tag from mock; detect mandrake, redhat, etc. the old fashioned way | |
6 | %if 0%{!?dist:1} | |
7 | %define courier_release %(test -e /etc/mandrake-release -o -e /etc/mandriva-release && release="mdk" ; if test $? != 0; then release="`rpm -q --queryformat='.rh%{VERSION}' redhat-release 2>/dev/null`" ; if test $? != 0 ; then release="`rpm -q --queryformat='.fc%{VERSION}' fedora-release 2>/dev/null`" ; if test $? != 0 ; then release="" ; fi ; fi ; fi ; echo "$release") | |
dd184caf | 8 | %else |
9 | %define courier_release %{nil} | |
d9898ee8 | 10 | %endif |
11 | ||
b0322a85 CE |
12 | %define using_systemd %(test -d /etc/systemd && echo 1 || echo 0) |
13 | ||
d9898ee8 | 14 | ################################################################################ |
15 | ||
16 | Name: courier-authlib | |
0e333c05 | 17 | Version: 0.69.0 |
dd184caf | 18 | Release: 1%{?dist}%{?courier_release} |
d9898ee8 | 19 | Summary: Courier authentication library |
20 | ||
21 | Group: System Environment/Daemons | |
b0322a85 | 22 | License: GPLv3 |
d9898ee8 | 23 | URL: http://www.courier-mta.org |
24 | ||
25 | ################################################################################ | |
26 | ||
0e333c05 | 27 | Source: http://downloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2 |
d9898ee8 | 28 | |
29 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | |
30 | ||
31 | ################################################################################ | |
32 | ||
33 | BuildRequires: libtool | |
34 | BuildRequires: openldap-devel | |
b0322a85 | 35 | BuildRequires: mysql-devel zlib-devel sqlite-devel |
d9898ee8 | 36 | BuildRequires: postgresql-devel |
37 | BuildRequires: gdbm-devel | |
38 | BuildRequires: pam-devel | |
39 | BuildRequires: expect | |
40 | BuildRequires: gcc-c++ | |
dd184caf | 41 | BuildRequires: redhat-rpm-config |
d50284c4 | 42 | BuildRequires: courier-unicode-devel |
d9898ee8 | 43 | |
44 | BuildRequires: %{_includedir}/ltdl.h | |
45 | ||
46 | %if 0%(rpm -q redhat-release >/dev/null 2>&1 || rpm -q fedora-release >/dev/null 2>&1 || exit 0; echo "1") | |
47 | BuildRequires: redhat-rpm-config | |
0e333c05 | 48 | BuildRequires: /usr/bin/ps |
d9898ee8 | 49 | %endif |
50 | ||
b0322a85 | 51 | %if %using_systemd |
d50284c4 CE |
52 | Requires(post): systemd |
53 | Requires(preun): systemd | |
54 | Requires(postun): systemd | |
b0322a85 | 55 | %else |
d9898ee8 | 56 | Requires(post): /sbin/chkconfig |
57 | Requires(preun): /sbin/chkconfig | |
b0322a85 | 58 | %endif |
ac40fd9e | 59 | |
0e333c05 CE |
60 | %define need_perl_generators %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "1"; exit 1) |
61 | ||
62 | %if %need_perl_generators | |
63 | BuildRequires: perl-generators | |
64 | %endif | |
65 | ||
d9898ee8 | 66 | ################################################################################ |
67 | ||
68 | %description | |
69 | The Courier authentication library provides authentication services for | |
70 | other Courier applications. | |
71 | ||
72 | ################################################################################ | |
73 | ||
74 | %package devel | |
75 | Summary: Development libraries for the Courier authentication library | |
76 | Group: Development/Libraries | |
77 | Requires: courier-authlib = 0:%{version}-%{release} | |
78 | ||
79 | %description devel | |
80 | This package contains the development libraries and files needed to compile | |
81 | Courier packages that use this authentication library. Install this | |
82 | package in order to build the rest of the Courier packages. After they are | |
83 | built and installed this package can be removed. Files in this package | |
84 | are not needed at runtime. | |
85 | ||
86 | ################################################################################ | |
87 | ||
88 | %package userdb | |
89 | ||
b0322a85 | 90 | Summary: Userdb support for the Courier authentication library |
d9898ee8 | 91 | Group: System Environment/Daemons |
92 | Requires: courier-authlib = 0:%{version}-%{release} | |
93 | ||
94 | %description userdb | |
95 | This package installs the userdb support for the Courier authentication | |
96 | library. Userdb is a simple way to manage virtual mail accounts using | |
97 | a GDBM-based database file. | |
98 | Install this package in order to be able to authenticate with userdb. | |
99 | ||
100 | ################################################################################ | |
101 | ||
102 | %package ldap | |
103 | ||
104 | Summary: LDAP support for the Courier authentication library | |
105 | Group: System Environment/Daemons | |
106 | Requires: courier-authlib = 0:%{version}-%{release} | |
107 | ||
108 | %description ldap | |
109 | This package installs LDAP support for the Courier authentication library. | |
110 | Install this package in order to be able to authenticate using LDAP. | |
111 | ||
112 | ################################################################################ | |
113 | ||
114 | %package mysql | |
115 | ||
116 | Summary: MySQL support for the Courier authentication library | |
117 | Group: System Environment/Daemons | |
118 | Requires: courier-authlib = 0:%{version}-%{release} | |
119 | ||
120 | %description mysql | |
121 | This package installs MySQL support for the Courier authentication library. | |
122 | Install this package in order to be able to authenticate using MySQL. | |
123 | ||
b0322a85 CE |
124 | %package sqlite |
125 | ||
126 | Summary: SQLite support for the Courier authentication library | |
127 | Group: System Environment/Daemons | |
128 | Requires: courier-authlib = 0:%{version}-%{release} | |
129 | ||
130 | %description sqlite | |
131 | This package installs SQLite support for the Courier authentication library. | |
132 | Install this package in order to be able to authenticate using an SQLite-based | |
133 | database file. | |
134 | ||
d9898ee8 | 135 | ################################################################################ |
136 | ||
137 | %package pgsql | |
138 | ||
b0322a85 | 139 | Summary: PostgreSQL support for the Courier authentication library |
d9898ee8 | 140 | Group: System Environment/Daemons |
141 | Requires: courier-authlib = 0:%{version}-%{release} | |
142 | ||
143 | %description pgsql | |
144 | This package installs PostgreSQL support for the Courier authentication | |
145 | library. | |
146 | Install this package in order to be able to authenticate using PostgreSQL. | |
147 | ||
148 | ################################################################################ | |
149 | ||
150 | %package pipe | |
151 | ||
152 | Summary: External authentication module that communicates via pipes | |
153 | Group: System Environment/Daemons | |
154 | Requires: courier-authlib = 0:%{version}-%{release} | |
155 | ||
156 | %description pipe | |
157 | This package installs the authpipe module, which is a generic plugin | |
158 | that enables authentication requests to be serviced by an external | |
159 | program, then communicates through messages on stdin and stdout. | |
160 | ||
161 | ################################################################################ | |
162 | ||
163 | %prep | |
164 | %setup -q | |
b0322a85 | 165 | PATH=/usr/bin:$PATH %configure -C --with-redhat |
d9898ee8 | 166 | |
167 | %build | |
dd184caf | 168 | %{__make} -s %{_smp_mflags} |
d9898ee8 | 169 | |
170 | %install | |
171 | rm -rf $RPM_BUILD_ROOT | |
172 | MAKEFLAGS= %{__make} -j 1 install DESTDIR=$RPM_BUILD_ROOT | |
173 | %{__rm} -f $RPM_BUILD_ROOT%{_libdir}/courier-authlib/*.a | |
174 | %{__install} -m 555 sysconftool $RPM_BUILD_ROOT%{_libexecdir}/courier-authlib | |
d9898ee8 | 175 | |
176 | ./courierauthconfig --configfiles >configtmp | |
8d138742 | 177 | . ./configtmp |
d9898ee8 | 178 | |
8d138742 CE |
179 | d=`pwd` |
180 | cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1 | |
181 | $d/authmksock ./socket || exit 1 | |
182 | cd $d || exit 1 | |
d9898ee8 | 183 | touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid.lock || exit 1 |
184 | touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid || exit 1 | |
185 | %{__chmod} 777 $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1 | |
186 | ||
187 | cat >configfiles.base <<EOF | |
188 | %defattr(-,$mailuser,$mailgroup,-) | |
189 | %{_sysconfdir}/authlib | |
190 | %{_libexecdir}/courier-authlib | |
191 | %dir %{_libdir}/courier-authlib | |
192 | %dir %attr(750,$mailuser,$mailgroup) %{_localstatedir}/spool/authdaemon | |
193 | EOF | |
194 | ||
195 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql | |
b0322a85 | 196 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.sqlite |
d9898ee8 | 197 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap |
198 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql | |
199 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb | |
200 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pipe | |
201 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel | |
202 | ||
203 | for f in $RPM_BUILD_ROOT%{_sbindir}/* | |
204 | do | |
205 | fn=`basename $f` | |
206 | case "$fn" in | |
207 | *userdb*) | |
208 | echo "%{_sbindir}/$fn" >>configfiles.userdb | |
209 | ;; | |
210 | *) | |
211 | echo "%{_sbindir}/$fn" >>configfiles.base | |
212 | ;; | |
213 | esac | |
214 | done | |
215 | ||
216 | for f in $RPM_BUILD_ROOT%{_libdir}/courier-authlib/* | |
217 | do | |
218 | fn=`basename $f` | |
b0322a85 CE |
219 | |
220 | # Remove *.la for authentication modules, keep the ones | |
221 | # for client libraries. Do this before we sort them into buckets, | |
222 | # below. | |
223 | ||
224 | case "$fn" in | |
225 | *.la) | |
226 | case "$fn" in | |
227 | libcourierauth*) | |
228 | ;; | |
229 | *) | |
230 | rm -f "$f" | |
231 | ;; | |
232 | esac | |
233 | continue | |
234 | ;; | |
235 | esac | |
236 | ||
d9898ee8 | 237 | case "$fn" in |
238 | libauthpipe*) | |
239 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pipe | |
240 | ;; | |
241 | libauthldap*) | |
242 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap | |
243 | ;; | |
244 | libauthmysql*) | |
245 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.mysql | |
246 | ;; | |
b0322a85 CE |
247 | libauthsqlite*) |
248 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.sqlite | |
249 | ;; | |
d9898ee8 | 250 | libauthpgsql*) |
251 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.pgsql | |
252 | ;; | |
253 | libauthldap*) | |
254 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.ldap | |
255 | ;; | |
256 | libauthuserdb*) | |
257 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.userdb | |
258 | ;; | |
259 | *) | |
260 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.base | |
261 | ;; | |
262 | esac | |
263 | done | |
b0322a85 CE |
264 | %if %using_systemd |
265 | %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir} | |
266 | %{__install} -m 555 courier-authlib.sysvinit $RPM_BUILD_ROOT%{_datadir} | |
267 | ||
268 | %{__mkdir_p} $RPM_BUILD_ROOT/lib/systemd/system | |
269 | %{__install} -m 644 courier-authlib.service $RPM_BUILD_ROOT/lib/systemd/system | |
270 | %else | |
d9898ee8 | 271 | %{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d |
272 | %{__install} -m 555 courier-authlib.sysvinit \ | |
b0322a85 CE |
273 | $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/courier-authlib |
274 | %endif | |
d9898ee8 | 275 | |
276 | %post | |
d9898ee8 | 277 | %{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/authlib/*.dist >/dev/null |
b0322a85 CE |
278 | %if %using_systemd |
279 | if test -f /etc/init.d/courier-authlib | |
280 | then | |
281 | # Upgrade to systemd | |
282 | ||
283 | /sbin/chkconfig --del courier-authlib | |
284 | /bin/systemctl stop courier-authlib.service || : | |
285 | fi | |
d50284c4 | 286 | %systemd_post courier-authlib.service |
0e333c05 CE |
287 | if [ $1 -eq 1 ] |
288 | then | |
289 | /bin/systemctl daemon-reload >/dev/null 2>&1 || : | |
290 | fi | |
b0322a85 | 291 | %else |
d9898ee8 | 292 | /sbin/chkconfig --del courier-authlib |
293 | /sbin/chkconfig --add courier-authlib | |
b0322a85 | 294 | %endif |
d9898ee8 | 295 | %preun |
d9898ee8 | 296 | if test "$1" = "0" |
297 | then | |
b0322a85 | 298 | %if %using_systemd |
d50284c4 | 299 | %systemd_preun courier-authlib.service |
b0322a85 CE |
300 | %else |
301 | /sbin/chkconfig --del courier-authlib | |
302 | %endif | |
d9898ee8 | 303 | fi |
304 | ||
b0322a85 CE |
305 | %postun |
306 | %if %using_systemd | |
0e333c05 CE |
307 | if [ $1 -eq 0 ] |
308 | then | |
309 | /bin/systemctl daemon-reload | |
310 | fi | |
d50284c4 | 311 | %systemd_postun_with_restart courier-authlib.service |
b0322a85 CE |
312 | %endif |
313 | ||
d9898ee8 | 314 | %clean |
315 | rm -rf $RPM_BUILD_ROOT | |
316 | ||
317 | ||
318 | %files -f configfiles.base | |
319 | %defattr(-,root,root,-) | |
320 | %doc README README*html README.authmysql.myownquery README.ldap | |
8d138742 | 321 | %doc NEWS COPYING* AUTHORS ChangeLog |
b0322a85 CE |
322 | %if %using_systemd |
323 | /lib/systemd/system/* | |
324 | %attr(755, bin, bin) %{_datadir}/courier-authlib.sysvinit | |
325 | %else | |
d9898ee8 | 326 | /etc/rc.d/init.d/* |
b0322a85 | 327 | %endif |
d9898ee8 | 328 | %ghost %attr(600, root, root) %{_localstatedir}/spool/authdaemon/pid.lock |
329 | %ghost %attr(644, root, root) %{_localstatedir}/spool/authdaemon/pid | |
330 | %ghost %attr(-, root, root) %{_localstatedir}/spool/authdaemon/socket | |
331 | %{_mandir}/man1/* | |
332 | ||
333 | %files -f configfiles.userdb userdb | |
334 | %{_mandir}/man8/*userdb* | |
335 | ||
336 | %files -f configfiles.devel devel | |
337 | %defattr(-,root,root,-) | |
338 | %{_bindir}/courierauthconfig | |
339 | %{_includedir}/* | |
340 | %{_mandir}/man3/* | |
b0322a85 | 341 | %{_libdir}/courier-authlib/*.la |
d9898ee8 | 342 | %doc authlib.html auth_*.html |
343 | ||
344 | %files -f configfiles.ldap ldap | |
345 | %defattr(-,root,root,-) | |
8d138742 | 346 | %doc authldap.schema authldap.ldif |
d9898ee8 | 347 | |
348 | %files -f configfiles.mysql mysql | |
349 | ||
b0322a85 CE |
350 | %files -f configfiles.sqlite sqlite |
351 | ||
d9898ee8 | 352 | %files -f configfiles.pgsql pgsql |
353 | ||
354 | %files -f configfiles.pipe pipe | |
355 | ||
356 | %changelog | |
357 | ||
358 | * Thu Sep 7 2006 Chris Petersen <rpm@forevermore.net> 0.58-2 | |
359 | - Make the spec a little prettier | |
360 | - Replace BuildPreReq with BuildRequires | |
361 | - Remove period from summaries (rpmlint) | |
362 | - Fix release tag to use %{?dist} macro if it's present | |
363 | - Change distro-detection to use "rh" and "fc" for version detection, and add support for mandriva | |
364 | ||
365 | * Sun Oct 3 2004 Mr. Sam <sam@email-scan.com> 0.50-1 | |
366 | - Initial build. |