1 %bcond_without ipv6 # disable IPv6 support
3 # Replace MODNAME with real module name.
4 # Replace VERSION with version since what confdir support was introduced for the module.
6 %define mod_name MODNAME
7 %define apxs %{_sbindir}/apxs1
8 Summary: Apache module: ...
9 Summary(pl): Modu³ Apache'a: ...
10 Name: apache1-mod_%{mod_name}
13 License: - (enter Apache/GPL/LGPL/BSD/BSD-like/other license name here)
14 Group: Networking/Daemons
19 BuildRequires: apache1-devel >= 1.3.33-2
20 %{?with_ipv6:BuildRequires: apache1(ipv6)-devel}
21 %{!?with_ipv6:BuildConflicts: apache1(ipv6)-devel}
22 Requires(triggerpostun): %{apxs}
23 Requires(triggerpostun): grep
24 Requires(triggerpostun): sed >= 4.0
25 Requires: apache1 >= 1.3.33-2
26 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
29 %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
32 MODNAME is Apache module...
37 %setup -q -n mod_%{mod_name}-%{version}
40 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
43 rm -rf $RPM_BUILD_ROOT
44 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d}
46 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
48 # module configuration
49 # - should contain LoadModule line
50 # - and directives must be between IfModule (so user could disable the module easily)
51 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
53 # or, if no directives needed, put just LoadModule line
54 echo 'LoadModule %{mod_name}_module modules/mod_%{mod_name}.so' > \
55 $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
58 rm -rf $RPM_BUILD_ROOT
61 if [ -f /var/lock/subsys/apache ]; then
62 /etc/rc.d/init.d/apache restart 1>&2
66 if [ "$1" = "0" ]; then
67 if [ -f /var/lock/subsys/apache ]; then
68 /etc/rc.d/init.d/apache restart 1>&2
72 # trigger for upgrading from pre confdir module
74 # if they had Include modulename.conf
75 %triggerpostun -- %{name} < VERSION
76 if grep -q '^Include conf\.d' /etc/apache/apache.conf; then
77 %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
79 /^Include.*mod_%{mod_name}\.conf/d
80 ' /etc/apache/apache.conf
82 # they're still using old apache.conf
84 s,^Include.*mod_%{mod_name}\.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf,
85 ' /etc/apache/apache.conf
87 if [ -f /var/lock/subsys/apache ]; then
88 /etc/rc.d/init.d/apache restart 1>&2
92 %triggerpostun -- apache1-mod_%{mod_name} < VERSION
93 # check that they're not using old apache.conf
94 if grep -q '^Include conf\.d' /etc/apache/apache.conf; then
95 %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
99 %defattr(644,root,root,755)
101 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf
102 %attr(755,root,root) %{_pkglibdir}/*