| 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 | |
| 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 | |
| 49 | %if %using_systemd |
| 50 | Requires(post): /bin/systemctl |
| 51 | Requires(preun): /bin/systemctl |
| 52 | %else |
| 53 | Requires(post): /sbin/chkconfig |
| 54 | Requires(preun): /sbin/chkconfig |
| 55 | %endif |
| 56 | |
| 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 | |
| 81 | Summary: Userdb support for the Courier authentication library |
| 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 | |
| 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 | |
| 126 | ################################################################################ |
| 127 | |
| 128 | %package pgsql |
| 129 | |
| 130 | Summary: PostgreSQL support for the Courier authentication library |
| 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 |
| 156 | PATH=/usr/bin:$PATH %configure -C --with-redhat |
| 157 | |
| 158 | %build |
| 159 | %{__make} -s %{_smp_mflags} |
| 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 |
| 166 | |
| 167 | ./courierauthconfig --configfiles >configtmp |
| 168 | . ./configtmp |
| 169 | |
| 170 | d=`pwd` |
| 171 | cd $RPM_BUILD_ROOT%{_localstatedir}/spool/authdaemon || exit 1 |
| 172 | $d/authmksock ./socket || exit 1 |
| 173 | cd $d || exit 1 |
| 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 |
| 187 | echo "%defattr(-,$mailuser,$mailgroup,-)" >configfiles.sqlite |
| 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` |
| 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 | |
| 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 | ;; |
| 238 | libauthsqlite*) |
| 239 | echo "%{_libdir}/courier-authlib/$fn" >>configfiles.sqlite |
| 240 | ;; |
| 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 |
| 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 |
| 262 | %{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d |
| 263 | %{__install} -m 555 courier-authlib.sysvinit \ |
| 264 | $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/courier-authlib |
| 265 | %endif |
| 266 | |
| 267 | %post |
| 268 | %{_libexecdir}/courier-authlib/sysconftool %{_sysconfdir}/authlib/*.dist >/dev/null |
| 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 |
| 277 | |
| 278 | /bin/systemctl daemon-reload || : |
| 279 | /bin/systemctl enable courier-authlib.service &> /dev/null || : |
| 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 | /bin/systemctl stop courier-authlib.service |
| 294 | /bin/systemctl disable courier-authlib.service |
| 295 | %else |
| 296 | /sbin/chkconfig --del courier-authlib |
| 297 | %endif |
| 298 | fi |
| 299 | |
| 300 | %postun |
| 301 | %if %using_systemd |
| 302 | /bin/systemctl daemon-reload || : |
| 303 | %endif |
| 304 | |
| 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 |
| 312 | %doc NEWS COPYING* AUTHORS ChangeLog |
| 313 | %if %using_systemd |
| 314 | /lib/systemd/system/* |
| 315 | %attr(755, bin, bin) %{_datadir}/courier-authlib.sysvinit |
| 316 | %else |
| 317 | /etc/rc.d/init.d/* |
| 318 | %endif |
| 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/* |
| 332 | %{_libdir}/courier-authlib/*.la |
| 333 | %doc authlib.html auth_*.html |
| 334 | |
| 335 | %files -f configfiles.ldap ldap |
| 336 | %defattr(-,root,root,-) |
| 337 | %doc authldap.schema authldap.ldif |
| 338 | |
| 339 | %files -f configfiles.mysql mysql |
| 340 | |
| 341 | %files -f configfiles.sqlite sqlite |
| 342 | |
| 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 | |