Fri, 12 Oct 2012 21:23:18 +0200
Correct mistakenly double inserted patch code and remove etc/sites,
because of the hard coded nature of Drupal and where it expects to
find domain paths corresponding to a multisite installation. The
correct path is share/sites and is already present.
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@530 | 34 | Version: 7.15 |
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@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@530 | 87 | variety of content. Drupal integrates many popular features of |
michael@529 | 88 | content management systems, weblogs, collaborative tools and |
michael@530 | 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@530 | 95 | regex = drupal-(\d\.\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}/share/drupal \ |
michael@529 | 113 | $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \ |
michael@529 | 114 | $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \ |
michael@529 | 115 | $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \ |
michael@529 | 116 | $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \ |
michael@529 | 117 | $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db |
michael@529 | 118 | |
michael@529 | 119 | # avoid copying unnecessary text files |
michael@529 | 120 | find . -name "*.orig" -print | xargs rm -f |
michael@529 | 121 | rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt |
michael@529 | 122 | rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt |
michael@529 | 123 | |
michael@529 | 124 | # install all files (and strip down installation afterwards) |
michael@529 | 125 | cp -rp * .htaccess \ |
michael@529 | 126 | $RPM_BUILD_ROOT%{l_prefix}/share/drupal/ |
michael@529 | 127 | |
michael@529 | 128 | # set data location |
michael@529 | 129 | ln -s ../../../../var/drupal/files \ |
michael@529 | 130 | $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files |
michael@529 | 131 | |
michael@530 | 132 | # install runcommand script |
michael@529 | 133 | %if "%{with_dcron}" == "yes" |
michael@529 | 134 | l_drupal_cron="no" |
michael@529 | 135 | %else |
michael@529 | 136 | l_drupal_cron="yes" |
michael@529 | 137 | %endif |
michael@529 | 138 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@529 | 139 | -e "s;@l_drupal_cron@;$l_drupal_cron;g" \ |
michael@529 | 140 | %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@529 | 141 | |
michael@529 | 142 | # install database setup script |
michael@529 | 143 | %if "%{with_mysql}" == "yes" |
michael@529 | 144 | l_dbtype="mysql" |
michael@529 | 145 | %endif |
michael@529 | 146 | %if "%{with_pgsql}" == "yes" |
michael@529 | 147 | l_dbtype="pgsql" |
michael@529 | 148 | %endif |
michael@529 | 149 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@529 | 150 | -e "s;@l_dbtype@;$l_dbtype;g" \ |
michael@529 | 151 | -e "s;@l_bash@;%{l_bash};g" \ |
michael@529 | 152 | %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup |
michael@529 | 153 | |
michael@529 | 154 | # install crond(8) job script |
michael@529 | 155 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@529 | 156 | %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron |
michael@529 | 157 | %if "%{with_dcron}" == "yes" |
michael@529 | 158 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@529 | 159 | $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs |
michael@529 | 160 | echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \ |
michael@529 | 161 | >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal |
michael@529 | 162 | %endif |
michael@529 | 163 | |
michael@529 | 164 | # install custom Apache configuration |
michael@529 | 165 | l_hostname=`%{l_shtool} echo -e %h` |
michael@529 | 166 | l_domainname=`%{l_shtool} echo -e %d | cut -c2-` |
michael@529 | 167 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@529 | 168 | -e "s;@l_hostname@;$l_hostname;g" \ |
michael@529 | 169 | -e "s;@l_domainname@;$l_domainname;g" \ |
michael@529 | 170 | %{SOURCE drupal-apache.conf} \ |
michael@529 | 171 | $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/ |
michael@529 | 172 | |
michael@529 | 173 | # determine installation files |
michael@529 | 174 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@529 | 175 | %{l_files_std} \ |
michael@529 | 176 | '%config %{l_prefix}/etc/drupal' \ |
michael@529 | 177 | %if "%{with_dcron}" == "yes" |
michael@529 | 178 | '%not %dir %{l_prefix}/etc/dcron' \ |
michael@529 | 179 | '%not %dir %{l_prefix}/etc/dcron/crontabs' \ |
michael@529 | 180 | '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \ |
michael@529 | 181 | %endif |
michael@529 | 182 | '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \ |
michael@529 | 183 | '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \ |
michael@529 | 184 | '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal' |
michael@529 | 185 | |
michael@529 | 186 | %files -f files |
michael@529 | 187 | |
michael@529 | 188 | %clean |
michael@529 | 189 | |
michael@529 | 190 | %post |
michael@529 | 191 | if [ $1 -eq 1 ]; then |
michael@529 | 192 | # display final hints on initial installation |
michael@529 | 193 | ( echo "1. To complete this installation of Drupal please start the RDBMS" |
michael@529 | 194 | echo " and initialize the Drupal database like this:" |
michael@529 | 195 | %if "%{with_mysql}" == "yes" |
michael@529 | 196 | echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start" |
michael@529 | 197 | %endif |
michael@529 | 198 | %if "%{with_pgsql}" == "yes" |
michael@529 | 199 | echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start" |
michael@529 | 200 | %endif |
michael@529 | 201 | echo " \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install" |
michael@529 | 202 | echo "" |
michael@529 | 203 | echo "2. Now start Drupal by running the command" |
michael@529 | 204 | echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start" |
michael@529 | 205 | echo " and connect with a browser to the URL:" |
michael@529 | 206 | echo " http://127.0.0.1:8080/drupal/install.php" |
michael@529 | 207 | echo " Follow the instructions. On the page \"Database configuration\"" |
michael@529 | 208 | %if "%{with_mysql}" == "yes" |
michael@529 | 209 | echo " use database type \"mysql\", database name \"drupal\", database" |
michael@529 | 210 | %endif |
michael@529 | 211 | %if "%{with_pgsql}" == "yes" |
michael@529 | 212 | echo " use database type \"pgsql\", database name \"drupal\", database" |
michael@529 | 213 | %endif |
michael@529 | 214 | echo " username \"drupal\" and database password \"drupal\". Also create" |
michael@529 | 215 | echo " an account and login. The first account will automatically become" |
michael@529 | 216 | echo " the main administrator account with total control over Drupal." |
michael@529 | 217 | echo "" |
michael@529 | 218 | echo "3. By default, Drupal runs its own Apache server on IPv4 address" |
michael@529 | 219 | echo " 127.0.0.1, TCP port 8080. Please change this by editing the" |
michael@529 | 220 | echo " \"Listen 127.0.0.1:8080\" directive in" |
michael@529 | 221 | echo " $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf" |
michael@529 | 222 | echo " Also do not forget to cp -p" |
michael@529 | 223 | echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php" |
michael@529 | 224 | echo " $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php" |
michael@529 | 225 | echo " and adjust the \$base_url variable." |
michael@529 | 226 | echo "" |
michael@529 | 227 | echo "4. Access Drupal via:" |
michael@529 | 228 | echo " http://127.0.0.1:8080/drupal/ (website view)" |
michael@529 | 229 | echo " http://127.0.0.1:8080/drupal/admin (website admin)" |
michael@529 | 230 | ) | %{l_rpmtool} msg -b -t notice |
michael@529 | 231 | fi |
michael@529 | 232 | if [ $1 -eq 2 ]; then |
michael@529 | 233 | # display final hints on update installation |
michael@529 | 234 | ( echo "Please perform a Drupal database upgrade by visiting the" |
michael@529 | 235 | echo " http://127.0.0.1:8080/drupal/update.php" |
michael@529 | 236 | echo "page on your Drupal website." |
michael@529 | 237 | ) | %{l_rpmtool} msg -b -t notice |
michael@529 | 238 | |
michael@529 | 239 | # after upgrade, restart service |
michael@529 | 240 | eval `%{l_rc} drupal status 2>/dev/null` |
michael@529 | 241 | [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart |
michael@529 | 242 | fi |
michael@529 | 243 | exit 0 |
michael@529 | 244 | |
michael@529 | 245 | %preun |
michael@529 | 246 | if [ $1 -eq 0 ]; then |
michael@529 | 247 | # before erase, stop service and remove log files |
michael@529 | 248 | %{l_rc} drupal stop 2>/dev/null |
michael@529 | 249 | $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true |
michael@529 | 250 | rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true |
michael@529 | 251 | rm -f $RPM_INSTALL_PREFIX/var/drupal/log/* >/dev/null 2>&1 || true |
michael@529 | 252 | rm -f $RPM_INSTALL_PREFIX/var/drupal/run/* >/dev/null 2>&1 || true |
michael@529 | 253 | rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/* >/dev/null 2>&1 || true |
michael@529 | 254 | rm -f $RPM_INSTALL_PREFIX/var/drupal/db/* >/dev/null 2>&1 || true |
michael@529 | 255 | fi |
michael@529 | 256 | exit 0 |
michael@529 | 257 |