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.223
9 Requires: apache >= 1.3.33-2
11 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
14 This spec is for demonstrating triggers used for linking package
15 config to apache1/apache2 configuration dir.
18 Ten spec s³u¿y do pokazania triggerów s³u¿±cych do pod³±czania
19 konfiguracji pakietu do katalogu konfiguracyjnego apache1/apache2.
24 rm -rf $RPM_BUILD_ROOT
25 install -d $RPM_BUILD_ROOT%{_sysconfdir}
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
32 # %apache_config_* macros usage extracted from /usr/lib/rpm/macros:
35 # %%apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
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
42 # %%apache_config_uninstall -v {1|2} -n 99
44 # -v REQUIRED: specify apache version. can be 1 or 2.
45 # -n OPTIONAL: specify config "slot". defaults to 99
47 %triggerin -- apache1 >= 1.3.33-2
48 %apache_config_install -v 1 -c %{_sysconfdir}/apache-%{name}.conf
50 %triggerun -- apache1 >= 1.3.33-2
51 %apache_config_uninstall -v 1
53 %triggerin -- apache >= 2.0.0
54 %apache_config_install -v 2 -c %{_sysconfdir}/apache-%{name}.conf
56 %triggerun -- apache >= 2.0.0
57 %apache_config_uninstall -v 2
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
71 # nuke very-old config location (is this needed?)
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
82 # place new config location, as trigger put config only on first install, do it here.
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
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
97 %endif # END OF SAMPLE TRIGGER
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