]> git.pld-linux.org Git - projects/template-specs.git/blob - apache1-module.spec
- possible ipv6 bcond
[projects/template-specs.git] / apache1-module.spec
1 %bcond_without  ipv6            # disable IPv6 support
2 #
3 # Replace MODNAME with real module name.
4 # Replace VERSION with version since what confdir support was introduced for the module.
5 #
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}
11 Version:        -
12 Release:        0.1
13 License:        - (enter Apache/GPL/LGPL/BSD/BSD-like/other license name here)
14 Group:          Networking/Daemons
15 Source0:        -
16 # Source0-md5:  -
17 Source1:        %{name}.conf
18 URL:            -
19 BuildRequires:  apache1-devel >= 1.3.33-2
20 %{?with_ipv6:BuildRequires:     apache1(ipv6)-devel}
21 Requires(triggerpostun):        %{apxs}
22 Requires(triggerpostun):        grep
23 Requires(triggerpostun):        sed >= 4.0
24 Requires:       apache1 >= 1.3.33-2
25 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
26
27 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
28 %define         _sysconfdir     %(%{apxs} -q SYSCONFDIR 2>/dev/null)
29
30 %description
31 MODNAME is Apache module...
32
33 %description -l pl
34
35 %prep
36 %setup -q -n mod_%{mod_name}-%{version}
37
38 %build
39 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
40
41 %install
42 rm -rf $RPM_BUILD_ROOT
43 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d}
44
45 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
46
47 # module configuration
48 # - should contain LoadModule line
49 # - and directives must be between IfModule (so user could disable the module easily)
50 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
51
52 # or, if no directives needed, put just LoadModule line
53 echo 'LoadModule %{mod_name}_module     modules/mod_%{mod_name}.so' > \
54         $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
55
56 %clean
57 rm -rf $RPM_BUILD_ROOT
58
59 %post
60 if [ -f /var/lock/subsys/apache ]; then
61         /etc/rc.d/init.d/apache restart 1>&2
62 fi
63
64 %preun
65 if [ "$1" = "0" ]; then
66         if [ -f /var/lock/subsys/apache ]; then
67                 /etc/rc.d/init.d/apache restart 1>&2
68         fi
69 fi
70
71 # trigger for upgrading from pre confdir module
72
73 # if they had Include modulename.conf
74 %triggerpostun -- %{name} < VERSION
75 if grep -q '^Include conf\.d' /etc/apache/apache.conf; then
76         %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
77         sed -i -e '
78                 /^Include.*mod_%{mod_name}\.conf/d
79         ' /etc/apache/apache.conf
80 else
81         # they're still using old apache.conf
82         sed -i -e '
83                 s,^Include.*mod_%{mod_name}\.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf,
84         ' /etc/apache/apache.conf
85 fi
86 if [ -f /var/lock/subsys/apache ]; then
87         /etc/rc.d/init.d/apache restart 1>&2
88 fi
89
90 # or it was just apxs
91 %triggerpostun -- apache1-mod_%{mod_name} < VERSION
92 # check that they're not using old apache.conf
93 if grep -q '^Include conf\.d' /etc/apache/apache.conf; then
94         %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
95 fi
96
97 %files
98 %defattr(644,root,root,755)
99 %doc README
100 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf
101 %attr(755,root,root) %{_pkglibdir}/*
This page took 0.034943 seconds and 4 git commands to generate.