]> git.pld-linux.org Git - projects/template-specs.git/blob - apache1-module.spec
- improved trigger
[projects/template-specs.git] / apache1-module.spec
1 #
2 # Replace MODNAME with real module name
3 # Replace OLDVERSION with version prior apache1 confdir support
4 #
5 %define         mod_name        MODNAME
6 %define         apxs            %{_sbindir}/apxs1
7 Summary:        Apache module: ...
8 Summary(pl):    Modu³ Apache'a: ...
9 Name:           apache1-mod_%{mod_name}
10 Version:        -
11 Release:        0.1
12 License:        - (enter Apache/GPL/LGPL/BSD/BSD-like/other license name here)
13 Group:          Networking/Daemons
14 Source0:        -
15 # Source0-md5:  -
16 Source1:        %{name}.conf
17 URL:            -
18 BuildRequires:  apache1-devel >= 1.3.33-2
19 Requires(triggerpostun):        %{apxs}
20 Requires(triggerpostun):        grep
21 Requires:       apache1
22 Conflicts:      apache1 < 1.3.33-2
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
26 %define         _sysconfdir     %(%{apxs} -q SYSCONFDIR 2>/dev/null)
27
28 %description
29 MODNAME is Apache module...
30
31 %description -l pl
32
33 %prep
34 %setup -q -n mod_%{mod_name}-%{version}
35
36 %build
37 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
38
39 %install
40 rm -rf $RPM_BUILD_ROOT
41 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d}
42
43 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
44 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/99_mod_%{mod_name}.conf
45
46 %clean
47 rm -rf $RPM_BUILD_ROOT
48
49 %post
50 if [ -f /var/lock/subsys/apache ]; then
51         /etc/rc.d/init.d/apache restart 1>&2
52 fi
53
54 %preun
55 if [ "$1" = "0" ]; then
56         if [ -f /var/lock/subsys/apache ]; then
57                 /etc/rc.d/init.d/apache restart 1>&2
58         fi
59 fi
60
61 %triggerpostun -- %{name} < OLDVERSION
62 if grep -q '^Include conf.d' /etc/apache/apache.conf; then
63         %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
64         sed -i -e '
65                 /^Include.*mod_%{mod_name}.conf/d
66         ' /etc/apache/apache.conf
67 else
68         # they're still using old apache.conf
69         sed -i -e '
70                 s,^Include.*mod_%{mod_name}.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf,
71         ' /etc/apache/apache.conf
72 fi
73 if [ -f /var/lock/subsys/apache ]; then
74         /etc/rc.d/init.d/apache restart 1>&2
75 fi
76
77 %files
78 %defattr(644,root,root,755)
79 %doc README
80 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf
81 %attr(755,root,root) %{_pkglibdir}/*
This page took 0.061553 seconds and 4 git commands to generate.