michael@529: ## michael@529: ## drupal.spec -- OpenPKG RPM Package Specification michael@529: ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. michael@529: ## michael@529: ## Permission to use, copy, modify, and distribute this software for michael@529: ## any purpose with or without fee is hereby granted, provided that michael@529: ## the above copyright notice and this permission notice appear in all michael@529: ## copies. michael@529: ## michael@529: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@529: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@529: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@529: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@529: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@529: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@529: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@529: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@529: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@529: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@529: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@529: ## SUCH DAMAGE. michael@529: ## michael@529: michael@529: # package information michael@529: Name: drupal michael@529: Summary: Content Management Platform michael@529: URL: http://www.drupal.org/ michael@529: Vendor: Dries Buytaert et al. michael@529: Packager: OpenPKG Foundation e.V. michael@529: Distribution: OpenPKG Community michael@529: Class: PLUS michael@529: Group: CMS michael@529: License: GPL michael@748: Version: 7.16 michael@530: Release: 20120800 michael@529: michael@529: # package options michael@529: %option with_mysql yes michael@529: %option with_pgsql no michael@529: %option with_dcron no michael@529: michael@529: # checking for option conflicts michael@529: %if "%{with_mysql}" == "no" && "%{with_pgsql}" == "no" michael@530: %{error:one of the buildtime options 'with_mysql' or 'with_pgsql' have to be enabled} michael@529: %endif michael@529: %if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes" michael@530: %{error:only one of the buildtime options 'with_mysql' or 'with_pgsql' can be enabled at a time} michael@529: %endif michael@529: michael@529: # list of sources michael@530: Source0: ftp://ftp.drupal.org/pub/drupal/files/projects/drupal-%{version}.tar.gz michael@529: Source1: drupal-setup.sh michael@529: Source2: drupal-cron.sh michael@529: Source3: drupal-apache.conf michael@529: Source4: rc.drupal michael@529: Patch0: drupal.patch michael@529: michael@529: # build information michael@529: BuildPreReq: OpenPKG, openpkg >= 20100101, infozip michael@529: PreReq: OpenPKG, openpkg >= 20100101 michael@529: PreReq: pcre, pcre::with_utf8 michael@529: PreReq: apache michael@529: PreReq: apache::with_mod_deflate = yes michael@529: PreReq: apache-php michael@529: PreReq: apache-php::with_ctype = yes michael@529: PreReq: apache-php::with_gd = yes michael@529: PreReq: apache-php::with_mbstring = yes michael@529: PreReq: apache-php::with_session = yes michael@529: PreReq: apache-php::with_mm = yes michael@529: PreReq: apache-php::with_xml = yes michael@748: PreReq: apache-php::with_xmlwriter = yes michael@529: PreReq: apache-php::with_xslt = yes michael@529: PreReq: apache-php::with_sendmail = yes michael@529: %if "%{with_mysql}" == "yes" michael@529: PreReq: apache-php::with_mysql = yes michael@529: %endif michael@529: %if "%{with_pgsql}" == "yes" michael@529: PreReq: apache-php::with_pgsql = yes michael@529: %endif michael@529: %if "%{with_dcron}" == "yes" michael@529: PreReq: dcron michael@529: %endif michael@529: PreReq: MTA michael@529: michael@529: %description michael@529: Drupal is a dynamic web site platform which allows an individual michael@529: or community of users to publish, manage and organize a michael@530: variety of content. Drupal integrates many popular features of michael@529: content management systems, weblogs, collaborative tools and michael@530: discussion based community software into one easy to use package. michael@529: michael@529: %track michael@529: prog drupal = { michael@529: version = %{version} michael@529: url = http://ftp.drupal.org/files/projects/ michael@530: regex = drupal-(\d\.\d+)\.tar\.gz michael@529: } michael@529: michael@529: %prep michael@529: # unpack core distribution michael@529: %setup -q -n drupal-%{version} michael@529: michael@529: # apply local patches michael@529: %patch -p0 michael@529: michael@529: %build michael@529: michael@529: %install michael@529: # create installation hierarchy michael@529: %{l_shtool} mkdir -f -p -m 755 \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/sbin \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ michael@748: $RPM_BUILD_ROOT%{l_prefix}/etc/drupal \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/share/drupal \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db michael@529: michael@529: # avoid copying unnecessary text files michael@529: find . -name "*.orig" -print | xargs rm -f michael@529: rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt michael@529: rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt michael@529: michael@529: # install all files (and strip down installation afterwards) michael@529: cp -rp * .htaccess \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/share/drupal/ michael@529: michael@529: # set data location michael@529: ln -s ../../../../var/drupal/files \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files michael@529: michael@530: # install runcommand script michael@529: %if "%{with_dcron}" == "yes" michael@529: l_drupal_cron="no" michael@529: %else michael@529: l_drupal_cron="yes" michael@529: %endif michael@529: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@529: -e "s;@l_drupal_cron@;$l_drupal_cron;g" \ michael@529: %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@529: michael@529: # install database setup script michael@529: %if "%{with_mysql}" == "yes" michael@529: l_dbtype="mysql" michael@529: %endif michael@529: %if "%{with_pgsql}" == "yes" michael@529: l_dbtype="pgsql" michael@529: %endif michael@529: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@529: -e "s;@l_dbtype@;$l_dbtype;g" \ michael@529: -e "s;@l_bash@;%{l_bash};g" \ michael@529: %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup michael@529: michael@529: # install crond(8) job script michael@529: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@529: %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron michael@529: %if "%{with_dcron}" == "yes" michael@529: %{l_shtool} mkdir -f -p -m 755 \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs michael@529: echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \ michael@529: >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal michael@529: %endif michael@529: michael@529: # install custom Apache configuration michael@529: l_hostname=`%{l_shtool} echo -e %h` michael@529: l_domainname=`%{l_shtool} echo -e %d | cut -c2-` michael@529: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@529: -e "s;@l_hostname@;$l_hostname;g" \ michael@529: -e "s;@l_domainname@;$l_domainname;g" \ michael@529: %{SOURCE drupal-apache.conf} \ michael@529: $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/ michael@529: michael@529: # determine installation files michael@529: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@529: %{l_files_std} \ michael@529: '%config %{l_prefix}/etc/drupal' \ michael@529: %if "%{with_dcron}" == "yes" michael@529: '%not %dir %{l_prefix}/etc/dcron' \ michael@529: '%not %dir %{l_prefix}/etc/dcron/crontabs' \ michael@529: '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \ michael@529: %endif michael@529: '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \ michael@529: '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \ michael@529: '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal' michael@529: michael@529: %files -f files michael@529: michael@529: %clean michael@529: michael@529: %post michael@529: if [ $1 -eq 1 ]; then michael@529: # display final hints on initial installation michael@529: ( echo "1. To complete this installation of Drupal please start the RDBMS" michael@529: echo " and initialize the Drupal database like this:" michael@529: %if "%{with_mysql}" == "yes" michael@529: echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start" michael@529: %endif michael@529: %if "%{with_pgsql}" == "yes" michael@529: echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" michael@529: %endif michael@529: echo " \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install" michael@529: echo "" michael@529: echo "2. Now start Drupal by running the command" michael@529: echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start" michael@529: echo " and connect with a browser to the URL:" michael@529: echo " http://127.0.0.1:8080/drupal/install.php" michael@529: echo " Follow the instructions. On the page \"Database configuration\"" michael@529: %if "%{with_mysql}" == "yes" michael@529: echo " use database type \"mysql\", database name \"drupal\", database" michael@529: %endif michael@529: %if "%{with_pgsql}" == "yes" michael@529: echo " use database type \"pgsql\", database name \"drupal\", database" michael@529: %endif michael@529: echo " username \"drupal\" and database password \"drupal\". Also create" michael@529: echo " an account and login. The first account will automatically become" michael@529: echo " the main administrator account with total control over Drupal." michael@529: echo "" michael@529: echo "3. By default, Drupal runs its own Apache server on IPv4 address" michael@529: echo " 127.0.0.1, TCP port 8080. Please change this by editing the" michael@529: echo " \"Listen 127.0.0.1:8080\" directive in" michael@529: echo " $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf" michael@529: echo " Also do not forget to cp -p" michael@529: echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php" michael@529: echo " $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php" michael@529: echo " and adjust the \$base_url variable." michael@529: echo "" michael@529: echo "4. Access Drupal via:" michael@529: echo " http://127.0.0.1:8080/drupal/ (website view)" michael@529: echo " http://127.0.0.1:8080/drupal/admin (website admin)" michael@529: ) | %{l_rpmtool} msg -b -t notice michael@529: fi michael@529: if [ $1 -eq 2 ]; then michael@529: # display final hints on update installation michael@529: ( echo "Please perform a Drupal database upgrade by visiting the" michael@529: echo " http://127.0.0.1:8080/drupal/update.php" michael@529: echo "page on your Drupal website." michael@529: ) | %{l_rpmtool} msg -b -t notice michael@529: michael@529: # after upgrade, restart service michael@529: eval `%{l_rc} drupal status 2>/dev/null` michael@529: [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart michael@529: fi michael@529: exit 0 michael@529: michael@529: %preun michael@529: if [ $1 -eq 0 ]; then michael@529: # before erase, stop service and remove log files michael@529: %{l_rc} drupal stop 2>/dev/null michael@529: $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true michael@529: rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true michael@529: rm -f $RPM_INSTALL_PREFIX/var/drupal/log/* >/dev/null 2>&1 || true michael@529: rm -f $RPM_INSTALL_PREFIX/var/drupal/run/* >/dev/null 2>&1 || true michael@529: rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/* >/dev/null 2>&1 || true michael@529: rm -f $RPM_INSTALL_PREFIX/var/drupal/db/* >/dev/null 2>&1 || true michael@529: fi michael@529: exit 0 michael@529: