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