]>
Commit | Line | Data |
---|---|---|
9407df51 ER |
1 | Summary: Package that uses Apache configuration |
2 | Name: template-apache-package | |
3 | Version: 0.1 | |
4 | Release: 0.7 | |
5 | License: Public Domain | |
6 | Group: Applications/WWW | |
7 | BuildArch: noarch | |
8 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
9 | ||
10 | %define _apache1dir /etc/apache | |
11 | %define _apache2dir /etc/httpd | |
12 | ||
13 | %description | |
14 | This spec is for demonstrating triggers used for linking package | |
15 | config to apache1/apache2 configuration dir. | |
16 | ||
17 | %prep | |
18 | ||
19 | %install | |
20 | rm -rf $RPM_BUILD_ROOT | |
21 | install -d $RPM_BUILD_ROOT%{_sysconfdir} | |
22 | cat >> $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf <<EOF | |
23 | # This is sample apache config | |
24 | EOF | |
25 | ||
9407df51 ER |
26 | %triggerin -- apache1 >= 1.3.33-2 |
27 | %{?debug:set -x; echo "triggerin apache1 %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} | |
28 | if [ -d %{_apache1dir}/conf.d ]; then | |
29 | ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache1dir}/conf.d/99_%{name}.conf | |
30 | if [ -f /var/lock/subsys/apache ]; then | |
31 | /etc/rc.d/init.d/apache restart 1>&2 | |
32 | fi | |
33 | fi | |
34 | ||
35 | %triggerun -- apache1 >= 1.3.33-2 | |
36 | %{?debug:set -x; echo "triggerun apache1 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} | |
37 | # remove link if eighter of the packages are gone | |
38 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then | |
39 | if [ -d %{_apache1dir}/conf.d ]; then | |
40 | rm -f %{_apache1dir}/conf.d/99_%{name}.conf | |
41 | if [ -f /var/lock/subsys/apache ]; then | |
42 | /etc/rc.d/init.d/apache restart 1>&2 | |
43 | fi | |
44 | fi | |
45 | fi | |
46 | ||
47 | %triggerin -- apache >= 2.0.0 | |
48 | %{?debug:set -x; echo "triggerin apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} | |
49 | if [ -d %{_apache2dir}/httpd.conf ]; then | |
50 | ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache2dir}/httpd.conf/99_%{name}.conf | |
51 | if [ -f /var/lock/subsys/httpd ]; then | |
52 | /etc/rc.d/init.d/httpd restart 1>&2 | |
53 | fi | |
54 | fi | |
55 | ||
56 | %triggerun -- apache >= 2.0.0 | |
57 | %{?debug:set -x; echo "triggerun apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} | |
58 | # remove link if eighter of the packages are gone | |
59 | if [ "$1" = "0" ] || [ "$2" = "0" ]; then | |
60 | if [ -d %{_apache2dir}/httpd.conf ]; then | |
61 | rm -f %{_apache2dir}/httpd.conf/99_%{name}.conf | |
62 | if [ -f /var/lock/subsys/httpd ]; then | |
63 | /etc/rc.d/init.d/httpd restart 1>&2 | |
64 | fi | |
65 | fi | |
66 | fi | |
e2b18c9c ER |
67 | |
68 | %files | |
69 | %defattr(644,root,root,755) | |
70 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache-%{name}.conf |