Import Debian changes 0.69.0-2
[hcoop/debian/courier-authlib.git] / courier-authlib.spec.in
... / ...
CommitLineData
1#
2# Copyright 1998 - 2017 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://downloads.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
48BuildRequires: /usr/bin/ps
49%endif
50
51%if %using_systemd
52Requires(post): systemd
53Requires(preun): systemd
54Requires(postun): systemd
55%else
56Requires(post): /sbin/chkconfig
57Requires(preun): /sbin/chkconfig
58%endif
59
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
63BuildRequires: perl-generators
64%endif
65
66################################################################################
67
68%description
69The Courier authentication library provides authentication services for
70other Courier applications.
71
72################################################################################
73
74%package devel
75Summary: Development libraries for the Courier authentication library
76Group: Development/Libraries
77Requires: courier-authlib = 0:%{version}-%{release}
78
79%description devel
80This package contains the development libraries and files needed to compile
81Courier packages that use this authentication library. Install this
82package in order to build the rest of the Courier packages. After they are
83built and installed this package can be removed. Files in this package
84are not needed at runtime.
85
86################################################################################
87
88%package userdb
89
90Summary: Userdb support for the Courier authentication library
91Group: System Environment/Daemons
92Requires: courier-authlib = 0:%{version}-%{release}
93
94%description userdb
95This package installs the userdb support for the Courier authentication
96library. Userdb is a simple way to manage virtual mail accounts using
97a GDBM-based database file.
98Install this package in order to be able to authenticate with userdb.
99
100################################################################################
101
102%package ldap
103
104Summary: LDAP support for the Courier authentication library
105Group: System Environment/Daemons
106Requires: courier-authlib = 0:%{version}-%{release}
107
108%description ldap
109This package installs LDAP support for the Courier authentication library.
110Install this package in order to be able to authenticate using LDAP.
111
112################################################################################
113
114%package mysql
115
116Summary: MySQL support for the Courier authentication library
117Group: System Environment/Daemons
118Requires: courier-authlib = 0:%{version}-%{release}
119
120%description mysql
121This package installs MySQL support for the Courier authentication library.
122Install this package in order to be able to authenticate using MySQL.
123
124%package sqlite
125
126Summary: SQLite support for the Courier authentication library
127Group: System Environment/Daemons
128Requires: courier-authlib = 0:%{version}-%{release}
129
130%description sqlite
131This package installs SQLite support for the Courier authentication library.
132Install this package in order to be able to authenticate using an SQLite-based
133database file.
134
135################################################################################
136
137%package pgsql
138
139Summary: PostgreSQL support for the Courier authentication library
140Group: System Environment/Daemons
141Requires: courier-authlib = 0:%{version}-%{release}
142
143%description pgsql
144This package installs PostgreSQL support for the Courier authentication
145library.
146Install this package in order to be able to authenticate using PostgreSQL.
147
148################################################################################
149
150%package pipe
151
152Summary: External authentication module that communicates via pipes
153Group: System Environment/Daemons
154Requires: courier-authlib = 0:%{version}-%{release}
155
156%description pipe
157This package installs the authpipe module, which is a generic plugin
158that enables authentication requests to be serviced by an external
159program, then communicates through messages on stdin and stdout.
160
161################################################################################
162
163%prep
164%setup -q
165PATH=/usr/bin:$PATH %configure -C --with-redhat
166
167%build
168%{__make} -s %{_smp_mflags}
169
170%install
171rm -rf $RPM_BUILD_ROOT
172MAKEFLAGS= %{__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
175
176./courierauthconfig --configfiles >configtmp
177. ./configtmp
178
179d=`pwd`
180cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1
181$d/authmksock ./socket || exit 1
182cd $d || exit 1
183touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid.lock || exit 1
184touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid || exit 1
185%{__chmod} 777 $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1
186
187cat >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
193EOF
194
195echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql
196echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.sqlite
197echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap
198echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql
199echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb
200echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pipe
201echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel
202
203for f in $RPM_BUILD_ROOT%{_sbindir}/*
204do
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
214done
215
216for f in $RPM_BUILD_ROOT%{_libdir}/courier-authlib/*
217do
218 fn=`basename $f`
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
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 ;;
247 libauthsqlite*)
248 echo "%{_libdir}/courier-authlib/$fn" >>configfiles.sqlite
249 ;;
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
263done
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
271%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
272%{__install} -m 555 courier-authlib.sysvinit \
273 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/courier-authlib
274%endif
275
276%post
277%{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/authlib/*.dist >/dev/null
278%if %using_systemd
279if test -f /etc/init.d/courier-authlib
280then
281# Upgrade to systemd
282
283 /sbin/chkconfig --del courier-authlib
284 /bin/systemctl stop courier-authlib.service || :
285fi
286%systemd_post courier-authlib.service
287if [ $1 -eq 1 ]
288then
289 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
290fi
291%else
292/sbin/chkconfig --del courier-authlib
293/sbin/chkconfig --add courier-authlib
294%endif
295%preun
296if test "$1" = "0"
297then
298%if %using_systemd
299%systemd_preun courier-authlib.service
300%else
301 /sbin/chkconfig --del courier-authlib
302%endif
303fi
304
305%postun
306%if %using_systemd
307if [ $1 -eq 0 ]
308then
309 /bin/systemctl daemon-reload
310fi
311%systemd_postun_with_restart courier-authlib.service
312%endif
313
314%clean
315rm -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
321%doc NEWS COPYING* AUTHORS ChangeLog
322%if %using_systemd
323/lib/systemd/system/*
324%attr(755, bin, bin) %{_datadir}/courier-authlib.sysvinit
325%else
326/etc/rc.d/init.d/*
327%endif
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/*
341%{_libdir}/courier-authlib/*.la
342%doc authlib.html auth_*.html
343
344%files -f configfiles.ldap ldap
345%defattr(-,root,root,-)
346%doc authldap.schema authldap.ldif
347
348%files -f configfiles.mysql mysql
349
350%files -f configfiles.sqlite sqlite
351
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.