]> git.pld-linux.org Git - projects/template-specs.git/blobdiff - apache1-module.spec
- spaces to tabs
[projects/template-specs.git] / apache1-module.spec
index cc59fddc37ed50525e602087c4ea64a0fa9e3c0a..07dfd36d6b23b4316840e8602f2cb9830ff02d36 100644 (file)
@@ -1,11 +1,15 @@
+# You'll need ipv6 bcond and patch if the module alters IP related structures.
+%bcond_without ipv6            # disable IPv6 support
 #
-# Replace MODNAME with real module name
-# Replace OLDVERSION with version prior apache1 confdir support
+# Replace MODNAME with real module name (example for mod_example)
+# Replace VERSION with version since what confdir support was
+# introduced for the module. only needed for older .specs, not needed
+# for new packages.
 #
 %define                mod_name        MODNAME
-%define        apxs            %{_sbindir}/apxs1
-Summary:       Apache module: ...
-Summary(pl):   Modu³ Apache'a: ...
+%define                apxs            %{_sbindir}/apxs1
+Summary:       Apache HTTPD module: ..
+Summary(pl.UTF-8):     Moduł Apache'a: ...
 Name:          apache1-mod_%{mod_name}
 Version:       -
 Release:       0.1
@@ -15,19 +19,23 @@ Source0:    -
 # Source0-md5: -
 Source1:       %{name}.conf
 URL:           -
-BuildRequires: apache1-devel >= 1.3.33-1.1
+%{?with_ipv6:BuildRequires:    apache1(ipv6)-devel}
+BuildRequires: apache1-devel >= 1.3.33-2
+BuildRequires: rpmbuild(macros) >= 1.228
+%{!?with_ipv6:BuildConflicts:  apache1(ipv6)-devel}
 Requires(triggerpostun):       %{apxs}
 Requires(triggerpostun):       grep
-Requires:      apache1
+Requires(triggerpostun):       sed >= 4.0
+Requires:      apache1(EAPI)
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define                _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
 %define                _sysconfdir     %(%{apxs} -q SYSCONFDIR 2>/dev/null)
 
 %description
-MODNAME is Apache module...
+MODNAME is Apache HTTPD module...
 
-%description -l pl
+%description -l pl.UTF-8
 
 %prep
 %setup -q -n mod_%{mod_name}-%{version}
@@ -40,41 +48,54 @@ rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d}
 
 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/99_mod_%{mod_name}.conf
+
+# module configuration
+# - should contain LoadModule line
+# - and directives must be between IfModule (so user could disable the module easily)
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
+
+# or, if no directives needed, put just LoadModule line
+echo 'LoadModule %{mod_name}_module    modules/mod_%{mod_name}.so' > \
+       $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
-if [ -f /var/lock/subsys/apache ]; then
-       /etc/rc.d/init.d/apache restart 1>&2
-fi
+%service apache restart
 
-%preun
+%postun
 if [ "$1" = "0" ]; then
-       if [ -f /var/lock/subsys/apache ]; then
-               /etc/rc.d/init.d/apache restart 1>&2
-       fi
+       %service -q apache restart
 fi
 
-%triggerpostun -- %{name} < OLDVERSION
-%{apxs} -e -A -n %{mod_name} %{_libexecdir}/mod_%{mod_name}.so 1>&2
-if grep -q '^Include conf.d' /etc/apache/apache.conf; then
+%if 0 # triggers for upgrading from pre confdir module
+# if there was "Include modulename.conf"
+%triggerpostun -- %{name} < VERSION
+if grep -q '^Include conf\.d/\*\.conf' /etc/apache/apache.conf; then
+       %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
        sed -i -e '
-               /^Include.*mod_%{mod_name}.conf/d
-       ' /etc/apache/apache.conf
+               /^Include.*mod_%{mod_name}\.conf/d
+' /etc/apache/apache.conf
 else
        # they're still using old apache.conf
        sed -i -e '
-               s,^Include.*mod_%{mod_name}.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf,
-       ' /etc/apache/apache.conf
+               s,^Include.*mod_%{mod_name}\.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf,
+' /etc/apache/apache.conf
 fi
-if [ -f /var/lock/subsys/apache ]; then
-       /etc/rc.d/init.d/apache restart 1>&2
+%service -q apache restart
+
+# or, if there was just apxs usage
+%triggerpostun -- apache1-mod_%{mod_name} < VERSION
+# check that they're not using old apache.conf
+if grep -q '^Include conf\.d/\*\.conf' /etc/apache/apache.conf; then
+       %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
 fi
 
+%endif
+
 %files
 %defattr(644,root,root,755)
 %doc README
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf
 %attr(755,root,root) %{_pkglibdir}/*
This page took 0.338115 seconds and 4 git commands to generate.