1 Summary: Package that uses webapps configuration
2 Summary(pl): Pakiet u¿ywaj±cy konfiguracji aplikacji WWW
8 BuildRequires: rpmbuild(macros) >= 1.264
11 Requires(triggerpostun): sed >= 4.0
14 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
16 %define _webapps /etc/webapps
17 %define _webapp sample-webapp
18 %define _sysconfdir %{_webapps}/%{_webapp}
21 This .spec is for demonstrating triggers used for linking webapp
22 configuration to webserver config dir.
25 Ten plik .spec s³u¿y do pokazania triggerów s³u¿±cych do pod³±czania
26 konfiguracji aplikacji WWW do katalogu konfiguracyjnego serwera WWW.
29 cat > config.conf <<EOF
30 # This is sample config
34 rm -rf $RPM_BUILD_ROOT
35 install -d $RPM_BUILD_ROOT%{_sysconfdir}
37 #install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
38 install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
39 install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
40 install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
42 # %webapp_* macros usage extracted from /usr/lib/rpm/macros.build:
45 # %%webapp_register HTTPD WEBAPP
46 # %%webapp_unregister HTTPD WEBAPP
49 %webapp_register apache %{_webapp}
52 %webapp_unregister apache %{_webapp}
54 %triggerin -- apache >= 2.0.0
55 %webapp_register httpd %{_webapp}
57 %triggerun -- apache >= 2.0.0
58 %webapp_unregister httpd %{_webapp}
60 %triggerin -- lighttpd
61 %webapp_register lighttpd %{_webapp}
63 %triggerun -- lighttpd
64 %webapp_unregister lighttpd %{_webapp}
66 %if 00000000000000000000000000000000000
67 # SAMPLE TRIGGER FOR MIGRATION PURPOSES
68 %triggerpostun -- %{name} < 1.3.9-1.4
69 # migrate from apache-config macros
70 if [ -f /etc/%{name}/apache.conf.rpmsave ]; then
71 if [ -d /etc/apache/webapps.d ]; then
72 cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
73 cp -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
76 if [ -d /etc/httpd/webapps.d ]; then
77 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
78 cp -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
81 # same but without separate %{_sysconfdir} for package
82 if [ -f /etc/apache-%{name}.conf.rpmsave ]; then
83 if [ -d /etc/apache/webapps.d ]; then
84 cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
85 cp -f /etc/apache-%{name}.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
88 if [ -d /etc/httpd/webapps.d ]; then
89 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
90 cp -f /etc/apache-%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
94 # migrate from httpd (apache2) config dir
95 if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
96 cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
97 cp -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
101 # nuke very-old config location (this mostly for Ra)
102 if [ -f /etc/httpd/httpd.conf ]; then
103 sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
107 # place new config location, as trigger puts config only on first install, do it here.
109 if [ -d /etc/apache/webapps.d ]; then
110 /usr/sbin/webapp register apache %{_webapp}
114 if [ -d /etc/httpd/webapps.d ]; then
115 /usr/sbin/webapp register httpd %{_webapp}
119 if [ "$httpd_reload" ]; the
120 if [ -f /var/lock/subsys/httpd ]; then
121 /etc/rc.d/init.d/httpd reload 1>&2
124 if [ "$apache_reload" ]; the
125 if [ -f /var/lock/subsys/apache ]; then
126 /etc/rc.d/init.d/apache reload 1>&2
129 %endif # END OF SAMPLE TRIGGER
132 rm -rf $RPM_BUILD_ROOT
135 %defattr(644,root,root,755)
136 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
137 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
138 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
139 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
141 #%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/*.php