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