]> git.pld-linux.org Git - projects/template-specs.git/blob - webapp.spec
- check for config symlink existince (rather than just confdir (the dir is out there...
[projects/template-specs.git] / webapp.spec
1 Summary:        Package that uses Apache configuration
2 Summary(pl):    Pakiet u¿ywaj±cy konfiguracji Apache'a
3 Name:           template-apache-package
4 Version:        0.1
5 Release:        0.12
6 License:        Public Domain
7 Group:          Applications/WWW
8 BuildArch:      noarch
9 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
10
11 %define         _apache1dir     /etc/apache
12 %define         _apache2dir     /etc/httpd
13
14 %description
15 This spec is for demonstrating triggers used for linking package
16 config to apache1/apache2 configuration dir.
17
18 %description -l pl
19 Ten spec s³u¿y do pokazania triggerów s³u¿±cych do pod³±czania
20 konfiguracji pakietu do katalogu konfiguracyjnego apache1/apache2.
21
22 %prep
23
24 %install
25 rm -rf $RPM_BUILD_ROOT
26 install -d $RPM_BUILD_ROOT%{_sysconfdir}
27 cat >> $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf <<EOF
28 # This is sample apache config
29 EOF
30
31 %triggerin -- apache1 >= 1.3.33-2
32 %{?debug:set -x; echo "triggerin apache1 %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"}
33 if [ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{_apache1dir}/conf.d ]; then
34         ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache1dir}/conf.d/99_%{name}.conf
35         if [ -f /var/lock/subsys/apache ]; then
36                 /etc/rc.d/init.d/apache restart 1>&2
37         fi
38 fi
39
40 %triggerun -- apache1 >= 1.3.33-2
41 %{?debug:set -x; echo "triggerun apache1 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"}
42 # remove link if eighter of the packages are gone
43 if [ "$1" = "0" ] || [ "$2" = "0" ]; then
44         if [ -L %{_apache1dir}/conf.d/99_%{name}.conf ]; then
45                 rm -f %{_apache1dir}/conf.d/99_%{name}.conf
46                 if [ -f /var/lock/subsys/apache ]; then
47                         /etc/rc.d/init.d/apache restart 1>&2
48                 fi
49         fi
50 fi
51
52 %triggerin -- apache >= 2.0.0
53 %{?debug:set -x; echo "triggerin apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"}
54 if [ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{_apache2dir}/httpd.conf ]; then
55         ln -sf %{_sysconfdir}/apache-%{name}.conf %{_apache2dir}/httpd.conf/99_%{name}.conf
56         if [ -f /var/lock/subsys/httpd ]; then
57                 /etc/rc.d/init.d/httpd restart 1>&2
58         fi
59 fi
60
61 %triggerun -- apache >= 2.0.0
62 %{?debug:set -x; echo "triggerun apache2 %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"}
63 # remove link if eighter of the packages are gone
64 if [ "$1" = "0" ] || [ "$2" = "0" ]; then
65         if [ -L %{_apache2dir}/httpd.conf/99_%{name}.conf ]; then
66                 rm -f %{_apache2dir}/httpd.conf/99_%{name}.conf
67                 if [ -f /var/lock/subsys/httpd ]; then
68                         /etc/rc.d/init.d/httpd restart 1>&2
69                 fi
70         fi
71 fi
72
73 %files
74 %defattr(644,root,root,755)
75 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache-%{name}.conf
This page took 0.03434 seconds and 4 git commands to generate.