| 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 | |
| 16 | Name: courier-authlib |
| 17 | Version: @VERSION@ |
| 18 | Release: 1%{?dist}%{?courier_release} |
| 19 | Summary: Courier authentication library |
| 20 | |
| 21 | Group: System Environment/Daemons |
| 22 | License: GPLv3 |
| 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 |
| 35 | BuildRequires: mysql-devel zlib-devel sqlite-devel |
| 36 | BuildRequires: postgresql-devel |
| 37 | BuildRequires: gdbm-devel |
| 38 | BuildRequires: pam-devel |
| 39 | BuildRequires: expect |
| 40 | BuildRequires: gcc-c++ |
| 41 | BuildRequires: redhat-rpm-config |
| 42 | BuildRequires: courier-unicode-devel |
| 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 |
| 48 | %endif |
| 49 | |
| 50 | %if %using_systemd |
| 51 | Requires(post): systemd |
| 52 | Requires(preun): systemd |
| 53 | Requires(postun): systemd |
| 54 | %else |
| 55 | Requires(post): /sbin/chkconfig |
| 56 | Requires(preun): /sbin/chkconfig |
| 57 | %endif |
| 58 | |
| 59 | ################################################################################ |
| 60 | |
| 61 | %description |
| 62 | The Courier authentication library provides authentication services for |
| 63 | other Courier applications. |
| 64 | |
| 65 | ################################################################################ |
| 66 | |
| 67 | %package devel |
| 68 | Summary: Development libraries for the Courier authentication library |
| 69 | Group: Development/Libraries |
| 70 | Requires: courier-authlib = 0:%{version}-%{release} |
| 71 | |
| 72 | %description devel |
| 73 | This package contains the development libraries and files needed to compile |
| 74 | Courier packages that use this authentication library. Install this |
| 75 | package in order to build the rest of the Courier packages. After they are |
| 76 | built and installed this package can be removed. Files in this package |
| 77 | are not needed at runtime. |
| 78 | |
| 79 | ################################################################################ |
| 80 | |
| 81 | %package userdb |
| 82 | |
| 83 | Summary: Userdb support for the Courier authentication library |
| 84 | Group: System Environment/Daemons |
| 85 | Requires: courier-authlib = 0:%{version}-%{release} |
| 86 | |
| 87 | %description userdb |
| 88 | This package installs the userdb support for the Courier authentication |
| 89 | library. Userdb is a simple way to manage virtual mail accounts using |
| 90 | a GDBM-based database file. |
| 91 | Install this package in order to be able to authenticate with userdb. |
| 92 | |
| 93 | ################################################################################ |
| 94 | |
| 95 | %package ldap |
| 96 | |
| 97 | Summary: LDAP support for the Courier authentication library |
| 98 | Group: System Environment/Daemons |
| 99 | Requires: courier-authlib = 0:%{version}-%{release} |
| 100 | |
| 101 | %description ldap |
| 102 | This package installs LDAP support for the Courier authentication library. |
| 103 | Install this package in order to be able to authenticate using LDAP. |
| 104 | |
| 105 | ################################################################################ |
| 106 | |
| 107 | %package mysql |
| 108 | |
| 109 | Summary: MySQL support for the Courier authentication library |
| 110 | Group: System Environment/Daemons |
| 111 | Requires: courier-authlib = 0:%{version}-%{release} |
| 112 | |
| 113 | %description mysql |
| 114 | This package installs MySQL support for the Courier authentication library. |
| 115 | Install this package in order to be able to authenticate using MySQL. |
| 116 | |
| 117 | %package sqlite |
| 118 | |
| 119 | Summary: SQLite support for the Courier authentication library |
| 120 | Group: System Environment/Daemons |
| 121 | Requires: courier-authlib = 0:%{version}-%{release} |
| 122 | |
| 123 | %description sqlite |
| 124 | This package installs SQLite support for the Courier authentication library. |
| 125 | Install this package in order to be able to authenticate using an SQLite-based |
| 126 | database file. |
| 127 | |
| 128 | ################################################################################ |
| 129 | |
| 130 | %package pgsql |
| 131 | |
| 132 | Summary: PostgreSQL support for the Courier authentication library |
| 133 | Group: System Environment/Daemons |
| 134 | Requires: courier-authlib = 0:%{version}-%{release} |
| 135 | |
| 136 | %description pgsql |
| 137 | This package installs PostgreSQL support for the Courier authentication |
| 138 | library. |
| 139 | Install this package in order to be able to authenticate using PostgreSQL. |
| 140 | |
| 141 | ################################################################################ |
| 142 | |
| 143 | %package pipe |
| 144 | |
| 145 | Summary: External authentication module that communicates via pipes |
| 146 | Group: System Environment/Daemons |
| 147 | Requires: courier-authlib = 0:%{version}-%{release} |
| 148 | |
| 149 | %description pipe |
| 150 | This package installs the authpipe module, which is a generic plugin |
| 151 | that enables authentication requests to be serviced by an external |
| 152 | program, then communicates through messages on stdin and stdout. |
| 153 | |
| 154 | ################################################################################ |
| 155 | |
| 156 | %prep |
| 157 | %setup -q |
| 158 | PATH=/usr/bin:$PATH %configure -C --with-redhat |
| 159 | |
| 160 | %build |
| 161 | %{__make} -s %{_smp_mflags} |
| 162 | |
| 163 | %install |
| 164 | rm -rf $RPM_BUILD_ROOT |
| 165 | MAKEFLAGS= %{__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 | |
| 172 | d=`pwd` |
| 173 | cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1 |
| 174 | $d/authmksock ./socket || exit 1 |
| 175 | cd $d || exit 1 |
| 176 | touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid.lock || exit 1 |
| 177 | touch $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/pid || exit 1 |
| 178 | %{__chmod} 777 $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon/socket || exit 1 |
| 179 | |
| 180 | cat >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 |
| 186 | EOF |
| 187 | |
| 188 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.mysql |
| 189 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.sqlite |
| 190 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.ldap |
| 191 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pgsql |
| 192 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.userdb |
| 193 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.pipe |
| 194 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.devel |
| 195 | |
| 196 | for f in $RPM_BUILD_ROOT%{_sbindir}/* |
| 197 | do |
| 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 |
| 207 | done |
| 208 | |
| 209 | for f in $RPM_BUILD_ROOT%{_libdir}/courier-authlib/* |
| 210 | do |
| 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 |
| 256 | done |
| 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 |
| 272 | if test -f /etc/init.d/courier-authlib |
| 273 | then |
| 274 | # Upgrade to systemd |
| 275 | |
| 276 | /sbin/chkconfig --del courier-authlib |
| 277 | /bin/systemctl stop courier-authlib.service || : |
| 278 | fi |
| 279 | %systemd_post courier-authlib.service |
| 280 | %else |
| 281 | /sbin/chkconfig --del courier-authlib |
| 282 | /sbin/chkconfig --add courier-authlib |
| 283 | %endif |
| 284 | %preun |
| 285 | if test -x %{_sbindir}/authdaemond |
| 286 | then |
| 287 | %{_sbindir}/authdaemond stop >/dev/null 2>&1 || /bin/true |
| 288 | fi |
| 289 | |
| 290 | if test "$1" = "0" |
| 291 | then |
| 292 | %if %using_systemd |
| 293 | %systemd_preun courier-authlib.service |
| 294 | %else |
| 295 | /sbin/chkconfig --del courier-authlib |
| 296 | %endif |
| 297 | fi |
| 298 | |
| 299 | %postun |
| 300 | %if %using_systemd |
| 301 | %systemd_postun_with_restart courier-authlib.service |
| 302 | %endif |
| 303 | |
| 304 | %clean |
| 305 | rm -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 | |