1 Summary: Package that uses webapps configuration
2 Summary(pl.UTF-8): Pakiet używający konfiguracji aplikacji WWW
7 Group: Applications/WWW
8 #Source0: %{name}-%{version}.tar.gz
11 BuildRequires: rpmbuild(macros) >= 1.268
14 Requires(triggerpostun): sed >= 4.0
16 # see SOURCES/webapps.README for description and complete listing
17 #Requires: webserver(access)
18 #Requires: webserver(alias)
19 #Requires: webserver(auth)
20 #Requires: webserver(cgi)
21 #Requires: webserver(indexfile)
23 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
25 %define _webapps /etc/webapps
26 %define _webapp %{name}
27 %define _sysconfdir %{_webapps}/%{_webapp}
28 #%define _appdir %{_datadir}/%{_webapp}
30 # in case _sysconfdir is not in webapps dir, run this replace pattern
31 # before copy-pasting to your spec: :%s#%{_sysconfdir}#%{_webapps}/%{_webapp}#g
34 This .spec is for demonstrating triggers used for linking webapp
35 configuration to webserver config dir.
37 %description -l pl.UTF-8
38 Ten plik .spec służy do pokazania triggerów służących do podłączania
39 konfiguracji aplikacji WWW do katalogu konfiguracyjnego serwera WWW.
44 cat > apache.conf <<'EOF'
45 Alias /%{name} %{_appdir}
46 <Directory %{_appdir}>
52 rm -rf $RPM_BUILD_ROOT
53 install -d $RPM_BUILD_ROOT%{_sysconfdir}
54 #install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_appdir}}
56 #install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
57 install apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
58 install apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
59 install lighttpd.conf $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
61 # %webapp_* macros usage extracted from /usr/lib/rpm/macros.build:
64 # %%webapp_register HTTPD WEBAPP
65 # %%webapp_unregister HTTPD WEBAPP
67 %triggerin -- apache1 < 1.3.37-3, apache1-base
68 %webapp_register apache %{_webapp}
70 %triggerun -- apache1 < 1.3.37-3, apache1-base
71 %webapp_unregister apache %{_webapp}
73 %triggerin -- apache < 2.2.0, apache-base
74 %webapp_register httpd %{_webapp}
76 %triggerun -- apache < 2.2.0, apache-base
77 %webapp_unregister httpd %{_webapp}
79 %triggerin -- lighttpd
80 %webapp_register lighttpd %{_webapp}
82 %triggerun -- lighttpd
83 %webapp_unregister lighttpd %{_webapp}
85 %if 00000000000000000000000000000000000
86 # SAMPLE TRIGGER FOR MIGRATION PURPOSES
87 %triggerpostun -- %{name} < 1.3.9-1.4
88 # rescue app configs. issue this in old config dir to get a list:
89 # rpm -qfl .|grep `pwd`/|awk -F/ '{print $NF}'|egrep -v 'apache|httpd'|xargs
90 for i in config.inc.php; do
91 if [ -f /etc/%{name}/$i.rpmsave ]; then
92 mv -f %{_sysconfdir}/$i{,.rpmnew}
93 mv -f /etc/%{name}/$i.rpmsave %{_sysconfdir}/$i
97 # nuke very-old config location (this mostly for Ra)
98 if [ -f /etc/httpd/httpd.conf ]; then
99 sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
103 # migrate from httpd (apache2) config dir
104 if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
105 cp -f %{_sysconfdir}/httpd.conf{,.rpmnew}
106 mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/httpd.conf
110 # migrate from apache-config macros
111 if [ -f /etc/%{name}/apache.conf.rpmsave ]; then
112 if [ -d /etc/apache/webapps.d ]; then
113 cp -f %{_sysconfdir}/apache.conf{,.rpmnew}
114 cp -f /etc/%{name}/apache.conf.rpmsave %{_sysconfdir}/apache.conf
117 if [ -d /etc/httpd/webapps.d ]; then
118 cp -f %{_sysconfdir}/httpd.conf{,.rpmnew}
119 cp -f /etc/%{name}/apache.conf.rpmsave %{_sysconfdir}/httpd.conf
121 rm -f /etc/%{name}/apache.conf.rpmsave
124 # same but without separate %{_sysconfdir} for package
125 if [ -f /etc/apache-%{name}.conf.rpmsave ]; then
126 if [ -d /etc/apache/webapps.d ]; then
127 cp -f %{_sysconfdir}/apache.conf{,.rpmnew}
128 cp -f /etc/apache-%{name}.conf.rpmsave %{_sysconfdir}/apache.conf
131 if [ -d /etc/httpd/webapps.d ]; then
132 cp -f %{_sysconfdir}/httpd.conf{,.rpmnew}
133 cp -f /etc/apache-%{name}.conf.rpmsave %{_sysconfdir}/httpd.conf
135 rm -f /etc/apache-%{name}.conf.rpmsave
138 # update htpasswd path
139 #sed -i -e 's,/etc/%{name},%{_webapps}/%{_webapp},' %{_webapps}/%{_webapp}/{apache,httpd}.conf
141 # migrating from earlier apache-config?
142 if [ -L /etc/apache/conf.d/99_%{name}.conf ] || [ -L /etc/httpd/httpd.conf/99_%{name}.conf ]; then
143 if [ -L /etc/apache/conf.d/99_%{name}.conf ]; then
144 rm -f /etc/apache/conf.d/99_%{name}.conf
147 if [ -L /etc/httpd/httpd.conf/99_%{name}.conf ]; then
148 rm -f /etc/httpd/httpd.conf/99_%{name}.conf
152 # no earlier registration. assume migration from Ra
153 if [ -d /etc/apache/webapps.d ]; then
156 if [ -d /etc/httpd/webapps.d ]; then
161 if [ "$apache_reload" ]; then
162 /usr/sbin/webapp register apache %{_webapp}
163 %service -q apache reload
165 if [ "$httpd_reload" ]; then
166 /usr/sbin/webapp register httpd %{_webapp}
167 %service -q httpd reload
169 %endif # END OF SAMPLE TRIGGER
172 rm -rf $RPM_BUILD_ROOT
175 %defattr(644,root,root,755)
176 %dir %attr(750,root,http) %{_sysconfdir}
177 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
178 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
179 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
180 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.php