]> git.pld-linux.org Git - projects/template-specs.git/blob - webapp.spec
- as per discussion in devel-en, unify virtual webserver usage
[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.19
6 License:        GPL
7 Group:          Development
8 BuildRequires:  rpmbuild(macros) >= 1.226
9 Requires:       webserver = apache
10 %if %{with trigger}
11 Requires(triggerpostun):        sed >= 4.0
12 %endif
13 Conflicts:      apache < 1.3.33-2
14 BuildArch:      noarch
15 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
16
17 %define         _sysconfdir     /etc/%{name}
18
19 %description
20 This spec is for demonstrating triggers used for linking package
21 config to apache1/apache2 configuration dir.
22
23 %description -l pl
24 Ten spec s³u¿y do pokazania triggerów s³u¿±cych do pod³±czania
25 konfiguracji pakietu do katalogu konfiguracyjnego apache1/apache2.
26
27 %prep
28
29 %install
30 rm -rf $RPM_BUILD_ROOT
31 install -d $RPM_BUILD_ROOT%{_sysconfdir}
32
33 #install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf
34 cat >> $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf <<EOF
35 # This is sample apache config
36 EOF
37
38 # %apache_config_* macros usage extracted from /usr/lib/rpm/macros:
39 #
40 # Usage:
41 #   %%apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
42 #
43 #  -v REQUIRED: specify apache version. can be 1 or 2.
44 #  -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
45 #  -n OPTIONAL: specify config "slot". defaults to 99
46 #
47 # Usage:
48 #   %%apache_config_uninstall -v {1|2} -n 99
49 #
50 #  -v REQUIRED: specify apache version. can be 1 or 2.
51 #  -n OPTIONAL: specify config "slot". defaults to 99
52
53 %triggerin -- apache1 >= 1.3.33-2
54 %apache_config_install -v 1 -c %{_sysconfdir}/apache-%{name}.conf
55
56 %triggerun -- apache1 >= 1.3.33-2
57 %apache_config_uninstall -v 1
58
59 %triggerin -- apache >= 2.0.0
60 %apache_config_install -v 2 -c %{_sysconfdir}/apache-%{name}.conf
61
62 %triggerun -- apache >= 2.0.0
63 %apache_config_uninstall -v 2
64
65 %if 00000000000000000000000000000000000
66 # SAMPLE TRIGGER FOR MIGRATION PURPOSES
67 %triggerpostun -- %{name} < 1.3.9-1.4
68 # migrate from old config location (only apache2, as there was no apache1 support)
69 if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
70         cp -f %{_sysconfdir}/apache-%{name}.conf{,.rpmnew}
71         mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/apache-%{name}.conf
72         if [ -f /var/lock/subsys/httpd ]; then
73                 /etc/rc.d/init.d/httpd reload 1>&2
74         fi
75 fi
76
77 # nuke very-old config location (this mostly for Ra)
78 if [ ! -d /etc/httpd/httpd.conf ]; then
79         sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
80         if [ -f /var/lock/subsys/httpd ]; then
81                 /etc/rc.d/init.d/httpd reload 1>&2
82         fi
83 fi
84
85 # place new config location, as trigger puts config only on first install, do it here.
86 # apache1
87 if [ -d /etc/apache/conf.d ]; then
88         ln -sf %{_sysconfdir}/apache-%{name}.conf /etc/apache/conf.d/99_%{name}.conf
89         if [ -f /var/lock/subsys/apache ]; then
90                 /etc/rc.d/init.d/apache reload 1>&2
91         fi
92 fi
93 # apache2
94 if [ -d /etc/httpd/httpd.conf ]; then
95         ln -sf %{_sysconfdir}/apache-%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
96         if [ -f /var/lock/subsys/httpd ]; then
97                 /etc/rc.d/init.d/httpd reload 1>&2
98         fi
99 fi
100 %endif # END OF SAMPLE TRIGGER
101
102 %clean
103 rm -rf $RPM_BUILD_ROOT
104
105 %files
106 %defattr(644,root,root,755)
107 #%attr(750,root,http) %dir %{_sysconfdir}
108 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache-%{name}.conf
109 #%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.php
This page took 0.186062 seconds and 4 git commands to generate.