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