[mod_auth_kerb] adapt for 2.2/2.4 dual use

jorton jorton at fedoraproject.org
Tue May 1 15:02:18 UTC 2012


commit 7c043d682264f32f52cb1a2627abdfa19a6838f1
Author: Joe Orton <jorton at redhat.com>
Date:   Fri Apr 27 15:13:02 2012 +0100

    adapt for 2.2/2.4 dual use

 mod_auth_kerb.spec |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/mod_auth_kerb.spec b/mod_auth_kerb.spec
index 240dd1e..fdc993d 100644
--- a/mod_auth_kerb.spec
+++ b/mod_auth_kerb.spec
@@ -1,3 +1,9 @@
+%{!?_httpd_apxs:       %{expand: %%global _httpd_apxs       %%{_sbindir}/apxs}}
+%{!?_httpd_mmn:        %{expand: %%global _httpd_mmn        %%(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)}}
+%{!?_httpd_confdir:    %{expand: %%global _httpd_confdir    %%{_sysconfdir}/httpd/conf.d}}
+# /etc/httpd/conf.d with httpd < 2.4 and defined as /etc/httpd/conf.modules.d with httpd >= 2.4
+%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}}
+%{!?_httpd_moddir:    %{expand: %%global _httpd_moddir    %%{_libdir}/httpd/modules}}
 
 Summary: Kerberos authentication module for HTTP
 Name: mod_auth_kerb
@@ -38,12 +44,18 @@ make %{?_smp_mflags}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT%{_libdir}/httpd/modules \
-         $RPM_BUILD_ROOT%{_httpd_modconfdir}
-install -m 755 src/.libs/mod_auth_kerb.so \
-        $RPM_BUILD_ROOT%{_libdir}/httpd/modules/mod_auth_kerb.so
-install -p -m 644 %{SOURCE1} \
-        $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-auth_kerb.conf
+install -Dm 755 src/.libs/mod_auth_kerb.so \
+        $RPM_BUILD_ROOT%{_httpd_moddir}/mod_auth_kerb.so
+
+%if "%{_httpd_modconfdir}" != "%{_httpd_confdir}"
+# httpd >= 2.4.x
+sed -n /^LoadModule/p %{SOURCE1} > 10-auth_kerb.conf
+sed '/LoadModule/d;/Location /,/Location>/s,^#,,' %{SOURCE1} > example.conf
+install -Dp -m 0644 10-auth_kerb.conf $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-auth_kerb.conf
+%else
+# httpd <= 2.2.x
+install -Dp -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_confdir}/auth_kerb.conf
+%endif
 
 # Copy the license files here so we can include them in %doc
 cp -p %{SOURCE2} .
@@ -55,6 +67,9 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %doc README LICENSE.ASL
 %config(noreplace) %{_httpd_modconfdir}/*.conf
+%if "%{_httpd_modconfdir}" != "%{_httpd_confdir}"
+%doc example.conf
+%endif
 %{_libdir}/httpd/modules/*.so
 
 %changelog


More information about the scm-commits mailing list