1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/drupal/drupal.spec Tue Aug 28 18:28:45 2012 +0200 1.3 @@ -0,0 +1,268 @@ 1.4 +## 1.5 +## drupal.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: drupal 1.29 +Summary: Content Management Platform 1.30 +URL: http://www.drupal.org/ 1.31 +Vendor: Dries Buytaert et al. 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: PLUS 1.35 +Group: CMS 1.36 +License: GPL 1.37 +Version: 6.22 1.38 +Release: 20110526 1.39 + 1.40 +# package options 1.41 +%option with_mysql yes 1.42 +%option with_pgsql no 1.43 +%option with_dcron no 1.44 + 1.45 +# checking for option conflicts 1.46 +%if "%{with_mysql}" == "no" && "%{with_pgsql}" == "no" 1.47 + %{error:one of the build-time options 'with_mysql' or 'with_pgsql' have to be enabled} 1.48 +%endif 1.49 +%if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes" 1.50 + %{error:only one of the build-time options 'with_mysql' or 'with_pgsql' can be enabled at a time} 1.51 +%endif 1.52 + 1.53 +# list of sources 1.54 +Source0: http://ftp.drupal.org/files/projects/drupal-%{version}.tar.gz 1.55 +Source1: drupal-setup.sh 1.56 +Source2: drupal-cron.sh 1.57 +Source3: drupal-apache.conf 1.58 +Source4: rc.drupal 1.59 +Patch0: drupal.patch 1.60 + 1.61 +# build information 1.62 +BuildPreReq: OpenPKG, openpkg >= 20100101, infozip 1.63 +PreReq: OpenPKG, openpkg >= 20100101 1.64 +PreReq: pcre, pcre::with_utf8 1.65 +PreReq: apache 1.66 +PreReq: apache::with_mod_deflate = yes 1.67 +PreReq: apache-php 1.68 +PreReq: apache-php::with_ctype = yes 1.69 +PreReq: apache-php::with_gd = yes 1.70 +PreReq: apache-php::with_mbstring = yes 1.71 +PreReq: apache-php::with_session = yes 1.72 +PreReq: apache-php::with_mm = yes 1.73 +PreReq: apache-php::with_xml = yes 1.74 +PreReq: apache-php::with_xslt = yes 1.75 +PreReq: apache-php::with_sendmail = yes 1.76 +%if "%{with_mysql}" == "yes" 1.77 +PreReq: apache-php::with_mysql = yes 1.78 +%endif 1.79 +%if "%{with_pgsql}" == "yes" 1.80 +PreReq: apache-php::with_pgsql = yes 1.81 +%endif 1.82 +%if "%{with_dcron}" == "yes" 1.83 +PreReq: dcron 1.84 +%endif 1.85 +PreReq: MTA 1.86 + 1.87 +%description 1.88 + Drupal is a dynamic web site platform which allows an individual 1.89 + or community of users to publish, manage and organize a 1.90 + variety of content, Drupal integrates many popular features of 1.91 + content management systems, weblogs, collaborative tools and 1.92 + discussion-based community software into one easy-to-use package. 1.93 + 1.94 +%track 1.95 + prog drupal = { 1.96 + version = %{version} 1.97 + url = http://ftp.drupal.org/files/projects/ 1.98 + regex = drupal-(6\.\d+)\.tar\.gz 1.99 + } 1.100 + 1.101 +%prep 1.102 + # unpack core distribution 1.103 + %setup -q -n drupal-%{version} 1.104 + 1.105 + # apply local patches 1.106 + %patch -p0 1.107 + 1.108 +%build 1.109 + 1.110 +%install 1.111 + # create installation hierarchy 1.112 + %{l_shtool} mkdir -f -p -m 755 \ 1.113 + $RPM_BUILD_ROOT%{l_prefix}/sbin \ 1.114 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ 1.115 + $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/sites \ 1.116 + $RPM_BUILD_ROOT%{l_prefix}/share/drupal \ 1.117 + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \ 1.118 + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \ 1.119 + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \ 1.120 + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \ 1.121 + $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db 1.122 + 1.123 + # avoid copying unnecessary text files 1.124 + find . -name "*.orig" -print | xargs rm -f 1.125 + rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt 1.126 + rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt 1.127 + 1.128 + # install all files (and strip down installation afterwards) 1.129 + cp -rp * .htaccess \ 1.130 + $RPM_BUILD_ROOT%{l_prefix}/share/drupal/ 1.131 + 1.132 + # pre-configure settings.php 1.133 + %{l_shtool} subst \ 1.134 +%if "%{with_mysql}" == "yes" 1.135 + -e 's|^\( *\$db_url\) *=.*$|\1 = "mysql://drupal:drupal@127.0.0.1/drupal";|' \ 1.136 +%endif 1.137 +%if "%{with_pgsql}" == "yes" 1.138 + -e 's|^\( *\$db_url\) *=.*$|\1 = "pgsql://drupal:drupal@127.0.0.1/drupal";|' \ 1.139 +%endif 1.140 + $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/default.settings.php 1.141 + 1.142 + # set data location 1.143 + ln -s ../../../../var/drupal/files \ 1.144 + $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files 1.145 + 1.146 + # install run-command script 1.147 +%if "%{with_dcron}" == "yes" 1.148 + l_drupal_cron="no" 1.149 +%else 1.150 + l_drupal_cron="yes" 1.151 +%endif 1.152 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.153 + -e "s;@l_drupal_cron@;$l_drupal_cron;g" \ 1.154 + %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.155 + 1.156 + # install database setup script 1.157 +%if "%{with_mysql}" == "yes" 1.158 + l_dbtype="mysql" 1.159 +%endif 1.160 +%if "%{with_pgsql}" == "yes" 1.161 + l_dbtype="pgsql" 1.162 +%endif 1.163 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.164 + -e "s;@l_dbtype@;$l_dbtype;g" \ 1.165 + -e "s;@l_bash@;%{l_bash};g" \ 1.166 + %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup 1.167 + 1.168 + # install crond(8) job script 1.169 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.170 + %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron 1.171 +%if "%{with_dcron}" == "yes" 1.172 + %{l_shtool} mkdir -f -p -m 755 \ 1.173 + $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs 1.174 + echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \ 1.175 + >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal 1.176 +%endif 1.177 + 1.178 + # install custom Apache configuration 1.179 + l_hostname=`%{l_shtool} echo -e %h` 1.180 + l_domainname=`%{l_shtool} echo -e %d | cut -c2-` 1.181 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.182 + -e "s;@l_hostname@;$l_hostname;g" \ 1.183 + -e "s;@l_domainname@;$l_domainname;g" \ 1.184 + %{SOURCE drupal-apache.conf} \ 1.185 + $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/ 1.186 + 1.187 + # determine installation files 1.188 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.189 + %{l_files_std} \ 1.190 + '%config %{l_prefix}/etc/drupal' \ 1.191 +%if "%{with_dcron}" == "yes" 1.192 + '%not %dir %{l_prefix}/etc/dcron' \ 1.193 + '%not %dir %{l_prefix}/etc/dcron/crontabs' \ 1.194 + '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \ 1.195 +%endif 1.196 + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \ 1.197 + '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \ 1.198 + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal' 1.199 + 1.200 +%files -f files 1.201 + 1.202 +%clean 1.203 + 1.204 +%post 1.205 + if [ $1 -eq 1 ]; then 1.206 + # display final hints on initial installation 1.207 + ( echo "1. To complete this installation of Drupal please start the RDBMS" 1.208 + echo " and initialize the Drupal database like this:" 1.209 +%if "%{with_mysql}" == "yes" 1.210 + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start" 1.211 +%endif 1.212 +%if "%{with_pgsql}" == "yes" 1.213 + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" 1.214 +%endif 1.215 + echo " \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install" 1.216 + echo "" 1.217 + echo "2. Now start Drupal by running the command" 1.218 + echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start" 1.219 + echo " and connect with a browser to the URL:" 1.220 + echo " http://127.0.0.1:8080/drupal/install.php" 1.221 + echo " Follow the instructions. On the page \"Database configuration\"" 1.222 +%if "%{with_mysql}" == "yes" 1.223 + echo " use database type \"mysql\", database name \"drupal\", database" 1.224 +%endif 1.225 +%if "%{with_pgsql}" == "yes" 1.226 + echo " use database type \"pgsql\", database name \"drupal\", database" 1.227 +%endif 1.228 + echo " username \"drupal\" and database password \"drupal\". Also create" 1.229 + echo " an account and login. The first account will automatically become" 1.230 + echo " the main administrator account with total control over Drupal." 1.231 + echo "" 1.232 + echo "3. By default, Drupal runs its own Apache server on IPv4 address" 1.233 + echo " 127.0.0.1, TCP port 8080. Please change this by editing the" 1.234 + echo " \"Listen 127.0.0.1:8080\" directive in" 1.235 + echo " $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf" 1.236 + echo " Also do not forget to cp -p" 1.237 + echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php" 1.238 + echo " $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php" 1.239 + echo " and adjust the \$base_url variable." 1.240 + echo "" 1.241 + echo "4. Access Drupal via:" 1.242 + echo " http://127.0.0.1:8080/drupal/ (website view)" 1.243 + echo " http://127.0.0.1:8080/drupal/admin (website admin)" 1.244 + ) | %{l_rpmtool} msg -b -t notice 1.245 + fi 1.246 + if [ $1 -eq 2 ]; then 1.247 + # display final hints on update installation 1.248 + ( echo "Please perform a Drupal database upgrade by visiting the" 1.249 + echo " http://127.0.0.1:8080/drupal/update.php" 1.250 + echo "page on your Drupal website." 1.251 + ) | %{l_rpmtool} msg -b -t notice 1.252 + 1.253 + # after upgrade, restart service 1.254 + eval `%{l_rc} drupal status 2>/dev/null` 1.255 + [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart 1.256 + fi 1.257 + exit 0 1.258 + 1.259 +%preun 1.260 + if [ $1 -eq 0 ]; then 1.261 + # before erase, stop service and remove log files 1.262 + %{l_rc} drupal stop 2>/dev/null 1.263 + $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true 1.264 + rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true 1.265 + rm -f $RPM_INSTALL_PREFIX/var/drupal/log/* >/dev/null 2>&1 || true 1.266 + rm -f $RPM_INSTALL_PREFIX/var/drupal/run/* >/dev/null 2>&1 || true 1.267 + rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/* >/dev/null 2>&1 || true 1.268 + rm -f $RPM_INSTALL_PREFIX/var/drupal/db/* >/dev/null 2>&1 || true 1.269 + fi 1.270 + exit 0 1.271 +