drupal/drupal.spec

Tue, 28 Aug 2012 18:28:45 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:28:45 +0200
changeset 529
7d4d11d301d6
child 530
5cd084e0397a
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

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

mercurial