drupal/drupal.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 750
0e7016e69724
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

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

mercurial