From 01e754b9c4b9f844299a074ee2af5256a63b597b Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 21 Feb 2013 12:44:23 +0100 Subject: [PATCH] templates/web: new template for web application packages --- ChangeLog | 3 ++ templates/Makefile | 2 +- templates/web | 110 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 templates/web diff --git a/ChangeLog b/ChangeLog index cb77da0..01ef282 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,9 @@ Changes in version 1.16.3 - Christmas Release Fix package version detection of source tarballs that have been created by 'git.create_tarball'. + * templates/web - Silvan Calarco + New template for web application packages + ------------------------------------------------------------------------------- Changes in version 1.16.2 - Christmas Release diff --git a/templates/Makefile b/templates/Makefile index e9a6c01..ed4a51b 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -18,7 +18,7 @@ srcdir = .. include $(srcdir)/Makefile.env -pck_templates := gnome kde3 kde4 library perl python standard standard-daemon +pck_templates := gnome kde3 kde4 library perl python standard standard-daemon web all: diff --git a/templates/web b/templates/web new file mode 100644 index 0000000..de0faa4 --- /dev/null +++ b/templates/web @@ -0,0 +1,110 @@ +%define serverdir %(apxs -q htdocsdir 2>/dev/null) +# To create a customized installation: +# autospec -u @pck_name@ -a5 \\ +# -d "installdir=%serverdir/../www.example.com, \\ +# sitename=example, \\ +# adminmail=webmaster@example.com" + +%if "%{?installdir}" == "" + %define installdir %{serverdir}/@pck_name@ +%endif + +%if "%{?sitename}" != "" + %if "%{?servername}" == "" + %define servername %(basename %installdir 2>/dev/null) + %endif + %define serverlogdir %(apxs -q logfiledir 2>/dev/null) +%else + %if "%{?aliasdir}" == "" + %define aliasdir /@pck_name@ + %endif +%endif + +Name: %{?sitename:%sitename-website-}@pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: Applications/Web +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: ... +Source: ... +License: ... +## AUTOBUILDREQ-BEGIN +## AUTOBUILDREQ-END +BuildArch: noarch +BuildRoot: @rpm_default_buildroot@ + +%description +... + +%prep +%setup -q + +%build + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +install -d %{buildroot}%{installdir} +cp -a * %{buildroot}%{installdir} +cp .htaccess %{buildroot}%{installdir} + +install -d %{buildroot}%{_sysconfdir}/httpd/httpd.d +%if "%{?sitename}" != "" +cat > %{buildroot}%{_sysconfdir}/httpd/httpd.d/%{servername}.conf << EOF +%else +cat > %{buildroot}%{_sysconfdir}/httpd/httpd.d/%{name}.conf << EOF +%endif +%if "%{?sitename}" == "" +%if "%(dirname %installdir)" != "%{serverdir}" +Alias %{aliasdir} %{installdir} + +%endif +%endif + + AllowOverride All + RewriteEngine On + Order allow,deny + Allow from All + +%if "%{?sitename}" != "" +%if "%(dirname %installdir)" != "%{serverdir}" + + + %{?adminmail:ServerAdmin %adminmail} + DocumentRoot %{installdir} + ServerName %{servername} + ErrorLog %{serverlogdir}/%{servername}-error_log + CustomLog %{serverlogdir}/%{servername}-access_log common + +%endif +%endif +EOF + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post +if [ $1 -ge 1 ]; then + [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || : +fi +: + +%files +%defattr(-,root,root) +%if "%{?sitename}" != "" +%config(noreplace) %{_sysconfdir}/httpd/httpd.d/%{servername}.conf +%else +%config(noreplace) %{_sysconfdir}/httpd/httpd.d/%{name}.conf +%endif +%dir %{installdir} +%{installdir}/.htaccess +%{installdir}/* +@standard_docs@ +## note: eventually add the remaining documents (if any) +# @standard_docs_devel@ + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@