]>
Commit | Line | Data |
---|---|---|
c30177e3 | 1 | # You'll need ipv6 bcond and patch if the module alters IP related structures. |
929e1f03 | 2 | %bcond_without ipv6 # disable IPv6 support |
17b23367 | 3 | # |
c29c2998 | 4 | # Replace MODNAME with real module name (example for mod_example) |
42f7a725 ER |
5 | # Replace VERSION with version since what confdir support was |
6 | # introduced for the module. only needed for older .specs, not needed | |
7 | # for new packages. | |
17b23367 ER |
8 | # |
9 | %define mod_name MODNAME | |
10 | %define apxs %{_sbindir}/apxs1 | |
6ea9291c | 11 | Summary: Apache HTTPD module: .. |
ce39d734 | 12 | Summary(pl.UTF-8): Moduł Apache'a: ... |
17b23367 | 13 | Name: apache1-mod_%{mod_name} |
c30177e3 | 14 | Version: - |
17b23367 ER |
15 | Release: 0.1 |
16 | License: - (enter Apache/GPL/LGPL/BSD/BSD-like/other license name here) | |
17 | Group: Networking/Daemons | |
18 | Source0: - | |
19 | # Source0-md5: - | |
20 | Source1: %{name}.conf | |
21 | URL: - | |
3b8982ee | 22 | %{?with_ipv6:BuildRequires: apache1(ipv6)-devel} |
0bff46b9 | 23 | BuildRequires: apache1-devel >= 1.3.33-2 |
42f7a725 | 24 | BuildRequires: rpmbuild(macros) >= 1.228 |
6c716adc | 25 | %{!?with_ipv6:BuildConflicts: apache1(ipv6)-devel} |
17b23367 ER |
26 | Requires(triggerpostun): %{apxs} |
27 | Requires(triggerpostun): grep | |
929e1f03 | 28 | Requires(triggerpostun): sed >= 4.0 |
3b8982ee | 29 | Requires: apache1(EAPI) |
17b23367 ER |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
31 | ||
32 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) | |
33 | %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null) | |
34 | ||
35 | %description | |
6ea9291c | 36 | MODNAME is Apache HTTPD module... |
17b23367 | 37 | |
9be49f18 | 38 | %description -l pl.UTF-8 |
17b23367 ER |
39 | |
40 | %prep | |
41 | %setup -q -n mod_%{mod_name}-%{version} | |
42 | ||
43 | %build | |
44 | %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so | |
45 | ||
46 | %install | |
47 | rm -rf $RPM_BUILD_ROOT | |
48 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d} | |
49 | ||
50 | install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir} | |
9bd62b83 ER |
51 | |
52 | # module configuration | |
53 | # - should contain LoadModule line | |
54 | # - and directives must be between IfModule (so user could disable the module easily) | |
55 | install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf | |
56 | ||
57 | # or, if no directives needed, put just LoadModule line | |
929e1f03 | 58 | echo 'LoadModule %{mod_name}_module modules/mod_%{mod_name}.so' > \ |
9bd62b83 | 59 | $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf |
17b23367 ER |
60 | |
61 | %clean | |
62 | rm -rf $RPM_BUILD_ROOT | |
63 | ||
64 | %post | |
42f7a725 | 65 | %service apache restart |
17b23367 | 66 | |
6c716adc | 67 | %postun |
17b23367 | 68 | if [ "$1" = "0" ]; then |
42f7a725 | 69 | %service -q apache restart |
17b23367 ER |
70 | fi |
71 | ||
42f7a725 ER |
72 | %if 0 # triggers for upgrading from pre confdir module |
73 | # if there was "Include modulename.conf" | |
9bd62b83 | 74 | %triggerpostun -- %{name} < VERSION |
b7a1769d | 75 | if grep -q '^Include conf\.d/\*\.conf' /etc/apache/apache.conf; then |
0bff46b9 | 76 | %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2 |
17b23367 | 77 | sed -i -e ' |
929e1f03 | 78 | /^Include.*mod_%{mod_name}\.conf/d |
c30177e3 | 79 | ' /etc/apache/apache.conf |
17b23367 ER |
80 | else |
81 | # they're still using old apache.conf | |
82 | sed -i -e ' | |
929e1f03 | 83 | s,^Include.*mod_%{mod_name}\.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf, |
c30177e3 | 84 | ' /etc/apache/apache.conf |
17b23367 | 85 | fi |
b7a1769d | 86 | %service -q apache restart |
17b23367 | 87 | |
42f7a725 | 88 | # or, if there was just apxs usage |
9bd62b83 ER |
89 | %triggerpostun -- apache1-mod_%{mod_name} < VERSION |
90 | # check that they're not using old apache.conf | |
b7a1769d | 91 | if grep -q '^Include conf\.d/\*\.conf' /etc/apache/apache.conf; then |
9bd62b83 ER |
92 | %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2 |
93 | fi | |
94 | ||
42f7a725 ER |
95 | %endif |
96 | ||
17b23367 ER |
97 | %files |
98 | %defattr(644,root,root,755) | |
99 | %doc README | |
c30177e3 | 100 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf |
17b23367 | 101 | %attr(755,root,root) %{_pkglibdir}/* |