drupal/drupal.spec

Sat, 27 Oct 2012 18:34:49 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 27 Oct 2012 18:34:49 +0200
changeset 750
0e7016e69724
parent 748
7548d72a64e3
child 754
5a7d77eba1e7
permissions
-rw-r--r--

Increase maximum length of user name to allow for proper full name printing.

     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.16
    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_xmlwriter = yes
    72 PreReq:       apache-php::with_xslt = yes
    73 PreReq:       apache-php::with_sendmail = yes
    74 %if "%{with_mysql}" == "yes"
    75 PreReq:       apache-php::with_mysql = yes
    76 %endif
    77 %if "%{with_pgsql}" == "yes"
    78 PreReq:       apache-php::with_pgsql = yes
    79 %endif
    80 %if "%{with_dcron}" == "yes"
    81 PreReq:       dcron
    82 %endif
    83 PreReq:       MTA
    85 %description
    86     Drupal is a dynamic web site platform which allows an individual
    87     or community of users to publish, manage and organize a
    88     variety of content. Drupal integrates many popular features of
    89     content management systems, weblogs, collaborative tools and
    90     discussion based community software into one easy to use package.
    92 %track
    93     prog drupal = {
    94         version   = %{version}
    95         url       = http://ftp.drupal.org/files/projects/
    96         regex     = drupal-(\d\.\d+)\.tar\.gz
    97     }
    99 %prep
   100     #   unpack core distribution
   101     %setup -q -n drupal-%{version}
   103     #   apply local patches
   104     %patch -p0
   106     #   correct flaws
   107     %{l_shtool} subst \
   108         -e 's;\(if (drupal_strlen(\$name) >\) 20);\1 32);' \
   109         -e 's;\(\$name = drupal_substr(\$name, 0,\) 15) \.;\1 28) .;' \
   110         includes/theme.inc
   112 %build
   114 %install
   115     #   create installation hierarchy
   116     %{l_shtool} mkdir -f -p -m 755 \
   117         $RPM_BUILD_ROOT%{l_prefix}/sbin \
   118         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   119         $RPM_BUILD_ROOT%{l_prefix}/etc/drupal \
   120         $RPM_BUILD_ROOT%{l_prefix}/share/drupal \
   121         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \
   122         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \
   123         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \
   124         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \
   125         $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db
   127     #   avoid copying unnecessary text files
   128     find . -name "*.orig" -print | xargs rm -f
   129     rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt
   130     rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt
   132     #   install all files (and strip down installation afterwards)
   133     cp -rp * .htaccess \
   134         $RPM_BUILD_ROOT%{l_prefix}/share/drupal/
   136     #   set data location
   137     ln -s ../../../../var/drupal/files \
   138         $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files
   140     #   install runcommand script
   141 %if "%{with_dcron}" == "yes"
   142     l_drupal_cron="no"
   143 %else
   144     l_drupal_cron="yes"
   145 %endif
   146     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   147         -e "s;@l_drupal_cron@;$l_drupal_cron;g" \
   148         %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   150     #   install database setup script
   151 %if "%{with_mysql}" == "yes"
   152     l_dbtype="mysql"
   153 %endif
   154 %if "%{with_pgsql}" == "yes"
   155     l_dbtype="pgsql"
   156 %endif
   157     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   158         -e "s;@l_dbtype@;$l_dbtype;g" \
   159         -e "s;@l_bash@;%{l_bash};g" \
   160         %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup
   162     #   install crond(8) job script
   163     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   164         %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron
   165 %if "%{with_dcron}" == "yes"
   166     %{l_shtool} mkdir -f -p -m 755 \
   167         $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs
   168     echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \
   169         >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal
   170 %endif
   172     #   install custom Apache configuration
   173     l_hostname=`%{l_shtool} echo -e %h`
   174     l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
   175     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   176         -e "s;@l_hostname@;$l_hostname;g" \
   177         -e "s;@l_domainname@;$l_domainname;g" \
   178         %{SOURCE drupal-apache.conf} \
   179         $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/
   181     #   determine installation files
   182     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   183         %{l_files_std} \
   184         '%config %{l_prefix}/etc/drupal' \
   185 %if "%{with_dcron}" == "yes"
   186         '%not %dir %{l_prefix}/etc/dcron' \
   187         '%not %dir %{l_prefix}/etc/dcron/crontabs' \
   188         '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \
   189 %endif
   190         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \
   191         '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \
   192         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal'
   194 %files -f files
   196 %clean
   198 %post
   199     if [ $1 -eq 1 ]; then
   200         #   display final hints on initial installation
   201         ( echo "1. To complete this installation of Drupal please start the RDBMS"
   202           echo "   and initialize the Drupal database like this:"
   203 %if "%{with_mysql}" == "yes"
   204           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
   205 %endif
   206 %if "%{with_pgsql}" == "yes"
   207           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
   208 %endif
   209           echo "     \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install"
   210           echo ""
   211           echo "2. Now start Drupal by running the command"
   212           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start"
   213           echo "   and connect with a browser to the URL:"
   214           echo "     http://127.0.0.1:8080/drupal/install.php"
   215           echo "   Follow the instructions. On the page \"Database configuration\""
   216 %if "%{with_mysql}" == "yes"
   217           echo "   use database type \"mysql\", database name \"drupal\", database"
   218 %endif
   219 %if "%{with_pgsql}" == "yes"
   220           echo "   use database type \"pgsql\", database name \"drupal\", database"
   221 %endif
   222           echo "   username \"drupal\" and database password \"drupal\". Also create"
   223           echo "   an account and login. The first account will automatically become"
   224           echo "   the main administrator account with total control over Drupal."
   225           echo ""
   226           echo "3. By default, Drupal runs its own Apache server on IPv4 address"
   227           echo "   127.0.0.1, TCP port 8080. Please change this by editing the"
   228           echo "   \"Listen 127.0.0.1:8080\" directive in"
   229           echo "     $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf"
   230           echo "   Also do not forget to cp -p"
   231           echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php"
   232           echo "     $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php"
   233           echo "   and adjust the \$base_url variable."
   234           echo ""
   235           echo "4. Access Drupal via:"
   236           echo "     http://127.0.0.1:8080/drupal/      (website view)"
   237           echo "     http://127.0.0.1:8080/drupal/admin (website admin)"
   238         ) | %{l_rpmtool} msg -b -t notice
   239     fi
   240     if [ $1 -eq 2 ]; then
   241         #   display final hints on update installation
   242         ( echo "Please perform a Drupal database upgrade by visiting the"
   243           echo "     http://127.0.0.1:8080/drupal/update.php"
   244           echo "page on your Drupal website."
   245         ) | %{l_rpmtool} msg -b -t notice
   247         #   after upgrade, restart service
   248         eval `%{l_rc} drupal status 2>/dev/null`
   249         [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart
   250     fi
   251     exit 0
   253 %preun
   254     if [ $1 -eq 0 ]; then
   255         #   before erase, stop service and remove log files
   256         %{l_rc} drupal stop 2>/dev/null
   257         $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true
   258         rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true
   259         rm -f $RPM_INSTALL_PREFIX/var/drupal/log/*   >/dev/null 2>&1 || true
   260         rm -f $RPM_INSTALL_PREFIX/var/drupal/run/*   >/dev/null 2>&1 || true
   261         rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/*  >/dev/null 2>&1 || true
   262         rm -f $RPM_INSTALL_PREFIX/var/drupal/db/*    >/dev/null 2>&1 || true
   263     fi
   264     exit 0

mercurial