1 Summary: Package that uses Apache configuration
2 Summary(pl): Pakiet u¿ywaj±cy konfiguracji Apache'a
3 Name: template-apache-package
8 BuildRequires: rpmbuild(macros) >= 1.226
9 Requires: webserver = apache
11 Requires(triggerpostun): sed >= 4.0
13 Conflicts: apache < 1.3.33-2
15 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
17 %define _sysconfdir /etc/%{name}
20 This spec is for demonstrating triggers used for linking package
21 config to apache1/apache2 configuration dir.
24 Ten spec s³u¿y do pokazania triggerów s³u¿±cych do pod³±czania
25 konfiguracji pakietu do katalogu konfiguracyjnego apache1/apache2.
30 rm -rf $RPM_BUILD_ROOT
31 install -d $RPM_BUILD_ROOT%{_sysconfdir}
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
38 # %apache_config_* macros usage extracted from /usr/lib/rpm/macros:
41 # %%apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
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
48 # %%apache_config_uninstall -v {1|2} -n 99
50 # -v REQUIRED: specify apache version. can be 1 or 2.
51 # -n OPTIONAL: specify config "slot". defaults to 99
53 %triggerin -- apache1 >= 1.3.33-2
54 %apache_config_install -v 1 -c %{_sysconfdir}/apache-%{name}.conf
56 %triggerun -- apache1 >= 1.3.33-2
57 %apache_config_uninstall -v 1
59 %triggerin -- apache >= 2.0.0
60 %apache_config_install -v 2 -c %{_sysconfdir}/apache-%{name}.conf
62 %triggerun -- apache >= 2.0.0
63 %apache_config_uninstall -v 2
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
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
85 # place new config location, as trigger puts config only on first install, do it here.
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
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
100 %endif # END OF SAMPLE TRIGGER
103 rm -rf $RPM_BUILD_ROOT
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