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