SPECS: template-webapp.spec - now webapp template
glen
glen at pld-linux.org
Mon Nov 21 00:15:50 CET 2005
Author: glen Date: Sun Nov 20 23:15:50 2005 GMT
Module: SPECS Tag: HEAD
---- Log message:
- now webapp template
---- Files affected:
SPECS:
template-webapp.spec (1.24 -> 1.25)
---- Diffs:
================================================================
Index: SPECS/template-webapp.spec
diff -u SPECS/template-webapp.spec:1.24 SPECS/template-webapp.spec:1.25
--- SPECS/template-webapp.spec:1.24 Tue Nov 15 23:41:10 2005
+++ SPECS/template-webapp.spec Mon Nov 21 00:15:45 2005
@@ -1,21 +1,23 @@
# $Revision$, $Date$
-Summary: Package that uses Apache configuration
+Summary: Package that uses webapps configuration
Summary(pl): Pakiet używający konfiguracji Apache'a
-Name: template-apache-package
-Version: 0.1
-Release: 0.19
+Name: template-webapp
+Version: 0.2
+Release: 0.6
License: GPL
Group: Development
-BuildRequires: rpmbuild(macros) >= 1.226
-Requires: webserver = apache
+BuildRequires: rpmbuild(macros) >= 1.264
+Requires: webapps
+Requires: webserver
%if %{with trigger}
Requires(triggerpostun): sed >= 4.0
%endif
-Conflicts: apache < 1.3.33-2
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _sysconfdir /etc/%{name}
+%define _webapps /etc/webapps
+%define _webapp sample-webapp
+%define _sysconfdir %{_webapps}/%{_webapp}
%description
This spec is for demonstrating triggers used for linking package
@@ -26,78 +28,106 @@
konfiguracji pakietu do katalogu konfiguracyjnego apache1/apache2.
%prep
+cat > config.conf <<EOF
+# This is sample config
+EOF
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_sysconfdir}
-#install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf
-cat >> $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf <<EOF
-# This is sample apache config
-EOF
+#install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
+install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
+install config.conf $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
-# %apache_config_* macros usage extracted from /usr/lib/rpm/macros:
-#
-# Usage:
-# %%apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
-#
-# -v REQUIRED: specify apache version. can be 1 or 2.
-# -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
-# -n OPTIONAL: specify config "slot". defaults to 99
+# %webapp_* macros usage extracted from /usr/lib/rpm/macros.build:
#
# Usage:
-# %%apache_config_uninstall -v {1|2} -n 99
-#
-# -v REQUIRED: specify apache version. can be 1 or 2.
-# -n OPTIONAL: specify config "slot". defaults to 99
+# %%webapp_register HTTPD WEBAPP
+# %%webapp_unregister HTTPD WEBAPP
-%triggerin -- apache1 >= 1.3.33-2
-%apache_config_install -v 1 -c %{_sysconfdir}/apache-%{name}.conf
+%triggerin -- apache1 >= 1.3.34-3.3
+%webapp_register apache %{_webapp}
%triggerun -- apache1 >= 1.3.33-2
-%apache_config_uninstall -v 1
+%webapp_unregister apache %{_webapp}
%triggerin -- apache >= 2.0.0
-%apache_config_install -v 2 -c %{_sysconfdir}/apache-%{name}.conf
+%webapp_register httpd %{_webapp}
%triggerun -- apache >= 2.0.0
-%apache_config_uninstall -v 2
+%webapp_unregister httpd %{_webapp}
+
+%triggerin -- lighttpd
+%webapp_register lighttpd %{_webapp}
+
+%triggerun -- lighttpd
+%webapp_unregister lighttpd %{_webapp}
%if 00000000000000000000000000000000000
# SAMPLE TRIGGER FOR MIGRATION PURPOSES
%triggerpostun -- %{name} < 1.3.9-1.4
-# migrate from old config location (only apache2, as there was no apache1 support)
-if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
- cp -f %{_sysconfdir}/apache-%{name}.conf{,.rpmnew}
- mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/apache-%{name}.conf
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd reload 1>&2
+# migrate from apache-config macros
+if [ -f /etc/%{name}/apache.conf.rpmsave ]; then
+ if [ -d /etc/apache/webapps.d ]; then
+ cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
+ cp -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
+ fi
+
+ if [ -d /etc/httpd/webapps.d ]; then
+ cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
+ cp -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
+ fi
+fi
+# same but without separate %{_sysconfdir} for package
+if [ -f /etc/apache-%{name}.conf.rpmsave ]; then
+ if [ -d /etc/apache/webapps.d ]; then
+ cp -f %{_webapps}/%{_webapp}/apache.conf{,.rpmnew}
+ cp -f /etc/apache-%{name}.conf.rpmsave %{_webapps}/%{_webapp}/apache.conf
+ fi
+
+ if [ -d /etc/httpd/webapps.d ]; then
+ cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
+ cp -f /etc/apache-%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
fi
fi
+# migrate from httpd (apache2) config dir
+if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
+ cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
+ cp -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
+ httpd_reload=1
+fi
+
# nuke very-old config location (this mostly for Ra)
-if [ ! -d /etc/httpd/httpd.conf ]; then
+if [ -f /etc/httpd/httpd.conf ]; then
sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd reload 1>&2
- fi
+ httpd_reload=1
fi
# place new config location, as trigger puts config only on first install, do it here.
# apache1
-if [ -d /etc/apache/conf.d ]; then
- ln -sf %{_sysconfdir}/apache-%{name}.conf /etc/apache/conf.d/99_%{name}.conf
- if [ -f /var/lock/subsys/apache ]; then
- /etc/rc.d/init.d/apache reload 1>&2
- fi
+if [ -d /etc/apache/webapps.d ]; then
+ /usr/sbin/webapp register apache %{_webapp}
+ apache_reload=1
fi
# apache2
-if [ -d /etc/httpd/httpd.conf ]; then
- ln -sf %{_sysconfdir}/apache-%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
+if [ -d /etc/httpd/webapps.d ]; then
+ /usr/sbin/webapp register httpd %{_webapp}
+ httpd_reload=1
+fi
+
+if [ "$httpd_reload" ]; the
if [ -f /var/lock/subsys/httpd ]; then
/etc/rc.d/init.d/httpd reload 1>&2
fi
fi
+if [ "$apache_reload" ]; the
+ if [ -f /var/lock/subsys/apache ]; then
+ /etc/rc.d/init.d/apache reload 1>&2
+ fi
+fi
%endif # END OF SAMPLE TRIGGER
%clean
@@ -105,9 +135,12 @@
%files
%defattr(644,root,root,755)
-#%attr(750,root,http) %dir %{_sysconfdir}
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache-%{name}.conf
-#%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.php
+%dir %attr(750,root,http) %{_webapps}/%{_webapp}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
+
+#%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/*.php
%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
%changelog
@@ -115,6 +148,9 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.25 2005/11/20 23:15:45 glen
+- now webapp template
+
Revision 1.24 2005/11/15 22:41:10 glen
- as per discussion in devel-en, unify virtual webserver usage
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SPECS/template-webapp.spec?r1=1.24&r2=1.25&f=u
More information about the pld-cvs-commit
mailing list