]> git.pld-linux.org Git - projects/template-specs.git/blob - apache1-module.spec
- restart apache in %postun rather in %preun
[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 %{!?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)
27
28 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
29 %define         _sysconfdir     %(%{apxs} -q SYSCONFDIR 2>/dev/null)
30
31 %description
32 MODNAME is Apache module...
33
34 %description -l pl
35
36 %prep
37 %setup -q -n mod_%{mod_name}-%{version}
38
39 %build
40 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
41
42 %install
43 rm -rf $RPM_BUILD_ROOT
44 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d}
45
46 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
47
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
52
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
56
57 %clean
58 rm -rf $RPM_BUILD_ROOT
59
60 %post
61 if [ -f /var/lock/subsys/apache ]; then
62         /etc/rc.d/init.d/apache restart 1>&2
63 fi
64
65 %postun
66 if [ "$1" = "0" ]; then
67         if [ -f /var/lock/subsys/apache ]; then
68                 /etc/rc.d/init.d/apache restart 1>&2
69         fi
70 fi
71
72 # trigger for upgrading from pre confdir module
73
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
78         sed -i -e '
79                 /^Include.*mod_%{mod_name}\.conf/d
80         ' /etc/apache/apache.conf
81 else
82         # they're still using old apache.conf
83         sed -i -e '
84                 s,^Include.*mod_%{mod_name}\.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf,
85         ' /etc/apache/apache.conf
86 fi
87 if [ -f /var/lock/subsys/apache ]; then
88         /etc/rc.d/init.d/apache restart 1>&2
89 fi
90
91 # or it was just apxs
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
96 fi
97
98 %files
99 %defattr(644,root,root,755)
100 %doc README
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}/*
This page took 0.033295 seconds and 4 git commands to generate.