drupal/drupal.spec

Wed, 12 Sep 2012 19:10:15 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 12 Sep 2012 19:10:15 +0200
changeset 675
43d642154330
parent 529
7d4d11d301d6
child 734
6f237b68bce5
permissions
-rw-r--r--

Although no hard dependency exists, include lynx(1) for use by MRTG.

     1 ##
     2 ##  drupal.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package information
    25 Name:         drupal
    26 Summary:      Content Management Platform
    27 URL:          http://www.drupal.org/
    28 Vendor:       Dries Buytaert et al.
    29 Packager:     OpenPKG Foundation e.V.
    30 Distribution: OpenPKG Community
    31 Class:        PLUS
    32 Group:        CMS
    33 License:      GPL
    34 Version:      7.15
    35 Release:      20120800
    37 #   package options
    38 %option       with_mysql   yes
    39 %option       with_pgsql   no
    40 %option       with_dcron   no
    42 #   checking for option conflicts
    43 %if "%{with_mysql}" == "no" && "%{with_pgsql}" == "no"
    44     %{error:one of the buildtime options 'with_mysql' or 'with_pgsql' have to be enabled}
    45 %endif
    46 %if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
    47     %{error:only one of the buildtime options 'with_mysql' or 'with_pgsql' can be enabled at a time}
    48 %endif
    50 #   list of sources
    51 Source0:      ftp://ftp.drupal.org/pub/drupal/files/projects/drupal-%{version}.tar.gz
    52 Source1:      drupal-setup.sh
    53 Source2:      drupal-cron.sh
    54 Source3:      drupal-apache.conf
    55 Source4:      rc.drupal
    56 Patch0:       drupal.patch
    58 #   build information
    59 BuildPreReq:  OpenPKG, openpkg >= 20100101, infozip
    60 PreReq:       OpenPKG, openpkg >= 20100101
    61 PreReq:       pcre, pcre::with_utf8
    62 PreReq:       apache
    63 PreReq:       apache::with_mod_deflate = yes
    64 PreReq:       apache-php
    65 PreReq:       apache-php::with_ctype = yes
    66 PreReq:       apache-php::with_gd = yes
    67 PreReq:       apache-php::with_mbstring = yes
    68 PreReq:       apache-php::with_session = yes
    69 PreReq:       apache-php::with_mm = yes
    70 PreReq:       apache-php::with_xml = yes
    71 PreReq:       apache-php::with_xslt = yes
    72 PreReq:       apache-php::with_sendmail = yes
    73 %if "%{with_mysql}" == "yes"
    74 PreReq:       apache-php::with_mysql = yes
    75 %endif
    76 %if "%{with_pgsql}" == "yes"
    77 PreReq:       apache-php::with_pgsql = yes
    78 %endif
    79 %if "%{with_dcron}" == "yes"
    80 PreReq:       dcron
    81 %endif
    82 PreReq:       MTA
    84 %description
    85     Drupal is a dynamic web site platform which allows an individual
    86     or community of users to publish, manage and organize a
    87     variety of content. Drupal integrates many popular features of
    88     content management systems, weblogs, collaborative tools and
    89     discussion based community software into one easy to use package.
    91 %track
    92     prog drupal = {
    93         version   = %{version}
    94         url       = http://ftp.drupal.org/files/projects/
    95         regex     = drupal-(\d\.\d+)\.tar\.gz
    96     }
    98 %prep
    99     #   unpack core distribution
   100     %setup -q -n drupal-%{version}
   102     #   apply local patches
   103     %patch -p0
   105 %build
   107 %install
   108     #   create installation hierarchy
   109     %{l_shtool} mkdir -f -p -m 755 \
   110         $RPM_BUILD_ROOT%{l_prefix}/sbin \
   111         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   112         $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/sites \
   113         $RPM_BUILD_ROOT%{l_prefix}/share/drupal \
   114         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \
   115         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \
   116         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \
   117         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \
   118         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db
   120     #   avoid copying unnecessary text files
   121     find . -name "*.orig" -print | xargs rm -f
   122     rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt
   123     rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt
   125     #   install all files (and strip down installation afterwards)
   126     cp -rp * .htaccess \
   127         $RPM_BUILD_ROOT%{l_prefix}/share/drupal/
   129     #   set data location
   130     ln -s ../../../../var/drupal/files \
   131         $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files
   133     #   install runcommand script
   134 %if "%{with_dcron}" == "yes"
   135     l_drupal_cron="no"
   136 %else
   137     l_drupal_cron="yes"
   138 %endif
   139     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   140         -e "s;@l_drupal_cron@;$l_drupal_cron;g" \
   141         %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   143     #   install database setup script
   144 %if "%{with_mysql}" == "yes"
   145     l_dbtype="mysql"
   146 %endif
   147 %if "%{with_pgsql}" == "yes"
   148     l_dbtype="pgsql"
   149 %endif
   150     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   151         -e "s;@l_dbtype@;$l_dbtype;g" \
   152         -e "s;@l_bash@;%{l_bash};g" \
   153         %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup
   155     #   install crond(8) job script
   156     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   157         %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron
   158 %if "%{with_dcron}" == "yes"
   159     %{l_shtool} mkdir -f -p -m 755 \
   160         $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs
   161     echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \
   162         >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal
   163 %endif
   165     #   install custom Apache configuration
   166     l_hostname=`%{l_shtool} echo -e %h`
   167     l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
   168     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   169         -e "s;@l_hostname@;$l_hostname;g" \
   170         -e "s;@l_domainname@;$l_domainname;g" \
   171         %{SOURCE drupal-apache.conf} \
   172         $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/
   174     #   determine installation files
   175     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   176         %{l_files_std} \
   177         '%config %{l_prefix}/etc/drupal' \
   178 %if "%{with_dcron}" == "yes"
   179         '%not %dir %{l_prefix}/etc/dcron' \
   180         '%not %dir %{l_prefix}/etc/dcron/crontabs' \
   181         '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \
   182 %endif
   183         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \
   184         '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \
   185         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal'
   187 %files -f files
   189 %clean
   191 %post
   192     if [ $1 -eq 1 ]; then
   193         #   display final hints on initial installation
   194         ( echo "1. To complete this installation of Drupal please start the RDBMS"
   195           echo "   and initialize the Drupal database like this:"
   196 %if "%{with_mysql}" == "yes"
   197           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
   198 %endif
   199 %if "%{with_pgsql}" == "yes"
   200           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
   201 %endif
   202           echo "     \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install"
   203           echo ""
   204           echo "2. Now start Drupal by running the command"
   205           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start"
   206           echo "   and connect with a browser to the URL:"
   207           echo "     http://127.0.0.1:8080/drupal/install.php"
   208           echo "   Follow the instructions. On the page \"Database configuration\""
   209 %if "%{with_mysql}" == "yes"
   210           echo "   use database type \"mysql\", database name \"drupal\", database"
   211 %endif
   212 %if "%{with_pgsql}" == "yes"
   213           echo "   use database type \"pgsql\", database name \"drupal\", database"
   214 %endif
   215           echo "   username \"drupal\" and database password \"drupal\". Also create"
   216           echo "   an account and login. The first account will automatically become"
   217           echo "   the main administrator account with total control over Drupal."
   218           echo ""
   219           echo "3. By default, Drupal runs its own Apache server on IPv4 address"
   220           echo "   127.0.0.1, TCP port 8080. Please change this by editing the"
   221           echo "   \"Listen 127.0.0.1:8080\" directive in"
   222           echo "     $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf"
   223           echo "   Also do not forget to cp -p"
   224           echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php"
   225           echo "     $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php"
   226           echo "   and adjust the \$base_url variable."
   227           echo ""
   228           echo "4. Access Drupal via:"
   229           echo "     http://127.0.0.1:8080/drupal/      (website view)"
   230           echo "     http://127.0.0.1:8080/drupal/admin (website admin)"
   231         ) | %{l_rpmtool} msg -b -t notice
   232     fi
   233     if [ $1 -eq 2 ]; then
   234         #   display final hints on update installation
   235         ( echo "Please perform a Drupal database upgrade by visiting the"
   236           echo "     http://127.0.0.1:8080/drupal/update.php"
   237           echo "page on your Drupal website."
   238         ) | %{l_rpmtool} msg -b -t notice
   240         #   after upgrade, restart service
   241         eval `%{l_rc} drupal status 2>/dev/null`
   242         [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart
   243     fi
   244     exit 0
   246 %preun
   247     if [ $1 -eq 0 ]; then
   248         #   before erase, stop service and remove log files
   249         %{l_rc} drupal stop 2>/dev/null
   250         $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true
   251         rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true
   252         rm -f $RPM_INSTALL_PREFIX/var/drupal/log/*   >/dev/null 2>&1 || true
   253         rm -f $RPM_INSTALL_PREFIX/var/drupal/run/*   >/dev/null 2>&1 || true
   254         rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/*  >/dev/null 2>&1 || true
   255         rm -f $RPM_INSTALL_PREFIX/var/drupal/db/*    >/dev/null 2>&1 || true
   256     fi
   257     exit 0

mercurial