]> git.pld-linux.org Git - projects/template-specs.git/blob - webapp.spec
- template for linking package config to apache
[projects/template-specs.git] / webapp.spec
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
26 %files
27 %defattr(644,root,root,755)
28 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache-%{name}.conf
29
30 %triggerin -- apache1 >= 1.3.33-2
31 %{?debug:set -x; echo "triggerin apache1 %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"}
32 if [ -d %{_apache1dir}/conf.d ]; then
33         ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache1dir}/conf.d/99_%{name}.conf
34         if [ -f /var/lock/subsys/apache ]; then
35                 /etc/rc.d/init.d/apache restart 1>&2
36         fi
37 fi
38
39 %triggerun -- apache1 >= 1.3.33-2
40 %{?debug:set -x; echo "triggerun apache1 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"}
41 # remove link if eighter of the packages are gone
42 if [ "$1" = "0" ] || [ "$2" = "0" ]; then
43         if [ -d %{_apache1dir}/conf.d ]; then
44                 rm -f %{_apache1dir}/conf.d/99_%{name}.conf
45                 if [ -f /var/lock/subsys/apache ]; then
46                         /etc/rc.d/init.d/apache restart 1>&2
47                 fi
48         fi
49 fi
50
51 %triggerin -- apache >= 2.0.0
52 %{?debug:set -x; echo "triggerin apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"}
53 if [ -d %{_apache2dir}/httpd.conf ]; then
54         ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache2dir}/httpd.conf/99_%{name}.conf
55         if [ -f /var/lock/subsys/httpd ]; then
56                 /etc/rc.d/init.d/httpd restart 1>&2
57         fi
58 fi
59
60 %triggerun -- apache >= 2.0.0
61 %{?debug:set -x; echo "triggerun apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"}
62 # remove link if eighter of the packages are gone
63 if [ "$1" = "0" ] || [ "$2" = "0" ]; then
64         if [ -d %{_apache2dir}/httpd.conf ]; then
65                 rm -f %{_apache2dir}/httpd.conf/99_%{name}.conf
66                 if [ -f /var/lock/subsys/httpd ]; then
67                         /etc/rc.d/init.d/httpd restart 1>&2
68                 fi
69         fi
70 fi
This page took 0.279373 seconds and 4 git commands to generate.