Import package vendor original specs for necessary manipulations.

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
parent 528
3b08e6396b45
child 530
5cd084e0397a

Import package vendor original specs for necessary manipulations.

drupal/drupal-apache.conf file | annotate | diff | comparison | revisions
drupal/drupal-cron.sh file | annotate | diff | comparison | revisions
drupal/drupal-setup.sh file | annotate | diff | comparison | revisions
drupal/drupal.patch file | annotate | diff | comparison | revisions
drupal/drupal.spec file | annotate | diff | comparison | revisions
drupal/rc.drupal file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/drupal/drupal-apache.conf	Tue Aug 28 18:28:45 2012 +0200
     1.3 @@ -0,0 +1,116 @@
     1.4 +##
     1.5 +##  drupal-apache.conf -- Drupal Apache Custom Configuration
     1.6 +##
     1.7 +
     1.8 +ServerRoot             @l_prefix@
     1.9 +ServerAdmin            root@@l_hostname@.@l_domainname@
    1.10 +ServerName             @l_hostname@.@l_domainname@
    1.11 +ServerTokens           Prod
    1.12 +User                   @l_rusr@
    1.13 +Group                  @l_rgrp@
    1.14 +Listen                 127.0.0.1:8080
    1.15 +
    1.16 +#   runtime files
    1.17 +PidFile                @l_prefix@/var/drupal/run/apache.pid
    1.18 +ScoreBoardFile         @l_prefix@/var/drupal/run/apache.sb
    1.19 +LockFile               @l_prefix@/var/drupal/run/apache.lck
    1.20 +
    1.21 +#   include apache-php
    1.22 +Include                @l_prefix@/etc/apache/apache.d/apache-php.conf
    1.23 +
    1.24 +#  server behaviour
    1.25 +Timeout                300
    1.26 +KeepAlive              on
    1.27 +MaxKeepAliveRequests   100
    1.28 +KeepAliveTimeout       15
    1.29 +MinSpareServers        5
    1.30 +MaxSpareServers        10
    1.31 +StartServers           5
    1.32 +MaxClients             15
    1.33 +MaxRequestsPerChild    500
    1.34 +HostnameLookups        off
    1.35 +UseCanonicalName       on
    1.36 +
    1.37 +#   access logging
    1.38 +LogFormat              "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    1.39 +LogFormat              "%h %l %u %t \"%r\" %>s %b" common
    1.40 +LogFormat              "%{Referer}i -> %U" referer
    1.41 +LogFormat              "%{User-agent}i" agent
    1.42 +CustomLog              @l_prefix@/var/drupal/log/apache.access.log common
    1.43 +
    1.44 +#   error logging
    1.45 +LogLevel               warn
    1.46 +ErrorLog               @l_prefix@/var/drupal/log/apache.error.log
    1.47 +ServerSignature        on
    1.48 +
    1.49 +#   secure root directory
    1.50 +<Directory />
    1.51 +    Options FollowSymLinks
    1.52 +    AllowOverride None
    1.53 +</Directory>
    1.54 +
    1.55 +#   browser specifics
    1.56 +BrowserMatch "Mozilla/2"       nokeepalive
    1.57 +BrowserMatch "MSIE 4\.0b2;"    nokeepalive downgrade-1.0 force-response-1.0
    1.58 +BrowserMatch "RealPlayer 4\.0" force-response-1.0
    1.59 +BrowserMatch "Java/1\.0"       force-response-1.0
    1.60 +BrowserMatch "JDK/1\.0"        force-response-1.0
    1.61 +
    1.62 +#   SSL/TLS support
    1.63 +<IfModule ssl_module>
    1.64 +    SSLRandomSeed           startup builtin
    1.65 +    SSLRandomSeed           connect builtin
    1.66 +    SSLMutex                sem
    1.67 +    SSLSessionCache         shmcb:@l_prefix@/var/drupal/run/apache.scache(512000)
    1.68 +    SSLSessionCacheTimeout  300
    1.69 +    SSLCipherSuite          ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    1.70 +    SetEnvIf User-Agent ".*MSIE.*" \
    1.71 +             nokeepalive ssl-unclean-shutdown \
    1.72 +             downgrade-1.0 force-response-1.0
    1.73 +    <Files ~ "\.(cgi|shtml|phtml|php?)$">
    1.74 +        SSLOptions +StdEnvVars
    1.75 +    </Files>
    1.76 +    <Directory "@l_prefix@/cgi">
    1.77 +        SSLOptions +StdEnvVars
    1.78 +    </Directory>
    1.79 +</IfModule>
    1.80 +
    1.81 +#   configure PHP for Drupal
    1.82 +AddType           application/x-httpd-php       .php
    1.83 +php_admin_flag    magic_quotes_gpc              off
    1.84 +php_admin_flag    register_globals              off
    1.85 +php_admin_flag    session.auto_start            off
    1.86 +php_admin_value   session.save_handler          user
    1.87 +php_admin_value   session.cache_limiter         none
    1.88 +php_admin_value   error_reporting               6135
    1.89 +php_admin_value   memory_limit                  64M
    1.90 +php_admin_value   mbstring.http_input           pass
    1.91 +php_admin_value   mbstring.http_output          pass
    1.92 +php_admin_flag    mbstring.encoding_translation off
    1.93 +php_admin_value   include_path                  .:@l_prefix@/share/drupal/includes
    1.94 +php_admin_value   upload_max_filesize           2M
    1.95 +php_admin_value   post_max_size                 8M
    1.96 +
    1.97 +#   configure Drupal
    1.98 +RewriteEngine     on
    1.99 +RewriteRule       ^/$ /drupal/ [R,L]
   1.100 +Alias             /drupal @l_prefix@/share/drupal
   1.101 +DocumentRoot      @l_prefix@/share/drupal
   1.102 +DirectoryIndex    index.php
   1.103 +ErrorDocument     404 /index.php
   1.104 +ExpiresByType     text/html A1
   1.105 +<Directory        @l_prefix@/share/drupal>
   1.106 +    Options       -Indexes +FollowSymLinks
   1.107 +    AllowOverride All
   1.108 +    Order         allow,deny
   1.109 +    Allow         from all
   1.110 +    RewriteEngine On
   1.111 +    RewriteBase   /drupal
   1.112 +</Directory>
   1.113 +<Location /drupal/sites/default/files/js>
   1.114 +    SetOutputFilter DEFLATE
   1.115 +</Location>
   1.116 +<Location /drupal/sites/default/files/css>
   1.117 +    SetOutputFilter DEFLATE
   1.118 +</Location>
   1.119 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/drupal/drupal-cron.sh	Tue Aug 28 18:28:45 2012 +0200
     2.3 @@ -0,0 +1,8 @@
     2.4 +#!/bin/sh
     2.5 +##
     2.6 +##  drupal-cron.sh -- Drupal Cron Job
     2.7 +##
     2.8 +
     2.9 +server=`grep '^Listen' @l_prefix@/etc/drupal/drupal-apache.conf | head -1 | awk '{ print $2; }'`
    2.10 +@l_prefix@/lib/openpkg/curl --silent --compressed http://$server/cron.php || true
    2.11 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/drupal/drupal-setup.sh	Tue Aug 28 18:28:45 2012 +0200
     3.3 @@ -0,0 +1,189 @@
     3.4 +#!@l_bash@
     3.5 +##
     3.6 +##  drupal-setup.sh -- Drupal RDBMS Setup Utility
     3.7 +##
     3.8 +
     3.9 +#   command line argument sanity check
    3.10 +prg="$0"
    3.11 +if [ $# -eq 0 ]; then
    3.12 +    echo "$prg:ERROR: invalid command line" 1>&2
    3.13 +    echo "$prg:USAGE: $prg install [<database-directory>]" 1>&2
    3.14 +    echo "$prg:USAGE: $prg uninstall" 1>&2
    3.15 +    echo "$prg:USAGE: $prg backup [<dump-file>]" 1>&2
    3.16 +    echo "$prg:USAGE: $prg restore [<dump-file>|<dump-number>]" 1>&2
    3.17 +    echo "$prg:USAGE: $prg edit" 1>&2
    3.18 +    exit 1
    3.19 +fi
    3.20 +
    3.21 +#   database configuration
    3.22 +db_dir="@l_prefix@/var/drupal/db"
    3.23 +db_dump="@l_prefix@/var/drupal/dump"
    3.24 +db_type="@l_dbtype@"
    3.25 +db_name="drupal"
    3.26 +db_user="drupal"
    3.27 +db_pass="drupal"
    3.28 +
    3.29 +#   determine RDBMS-specific details
    3.30 +if [ ".$db_type" = .mysql ]; then
    3.31 +    db_sname="mysql"
    3.32 +    db_suser=`grep "^user" @l_prefix@/etc/mysql/my.pwd |\
    3.33 +              sed -e 's;^user[^=]*= *;;' -e 's; *$;;'`
    3.34 +    db_spass=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\
    3.35 +              sed -e 's;^password[^=]*= *;;' -e 's; *$;;'`
    3.36 +elif [ ".$db_type" = .pgsql ]; then
    3.37 +    db_sname=`grep "^superuser_database" @l_prefix@/var/postgresql/db/pg_superuser.conf |\
    3.38 +              sed -e 's;^ *superuser_database="\(.*\)".*;\1;'`
    3.39 +    db_suser=`grep "^superuser_username" @l_prefix@/var/postgresql/db/pg_superuser.conf |\
    3.40 +              sed -e 's;^ *superuser_username="\(.*\)".*;\1;'`
    3.41 +    db_spass=`grep "^superuser_password" @l_prefix@/var/postgresql/db/pg_superuser.conf |\
    3.42 +              sed -e 's;^ *superuser_password="\(.*\)".*;\1;'`
    3.43 +fi
    3.44 +
    3.45 +#   dispatch operation
    3.46 +cmd="${1:-"install"}"
    3.47 +shift
    3.48 +case "$cmd" in
    3.49 +    install )
    3.50 +        ##
    3.51 +        ##  create the database
    3.52 +        ##
    3.53 +
    3.54 +        if [ $# -gt 0 ]; then
    3.55 +            db_dir="$1"
    3.56 +            shift
    3.57 +        fi
    3.58 +        if [ ".$db_type" = .mysql ]; then
    3.59 +            #   FIXME: MySQL 5.0 still doesn't allow easy relocation of tablespaces
    3.60 +            @l_prefix@/bin/mysqladmin --user="$db_suser" --password="$db_spass" create "$db_name"
    3.61 +            ( echo "GRANT ALL PRIVILEGES ON $db_name.* TO $db_user@localhost IDENTIFIED BY '$db_pass';"
    3.62 +              echo "FLUSH PRIVILEGES;"
    3.63 +            ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_sname"
    3.64 +        elif [ ".$db_type" = .pgsql ]; then
    3.65 +            ( echo "CREATE ROLE $db_user LOGIN ENCRYPTED PASSWORD '$db_pass' NOCREATEDB NOCREATEUSER;"
    3.66 +              echo "CREATE TABLESPACE $db_name OWNER $db_user LOCATION '$db_dir';"
    3.67 +              echo "CREATE DATABASE $db_name OWNER $db_user TABLESPACE $db_name ENCODING 'UTF8' TEMPLATE template0;"
    3.68 +            ) | PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_sname" -f-
    3.69 +        fi
    3.70 +
    3.71 +        #   activate configuration directory
    3.72 +        #   (is automatically deactivated by installer afterwards)
    3.73 +        if [ ".$DRUPAL_SETUP_RESTORE" = . ]; then
    3.74 +            chmod 777 @l_prefix@/share/drupal/sites/default
    3.75 +        fi
    3.76 +        ;;
    3.77 +
    3.78 +    uninstall )
    3.79 +        ##
    3.80 +        ##  remove the database
    3.81 +        ##
    3.82 +
    3.83 +        if [ ".$db_type" = .mysql ]; then
    3.84 +            ( echo "DROP DATABASE $db_name;"
    3.85 +            ) | @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_sname"
    3.86 +        elif [ ".$db_type" = .pgsql ]; then
    3.87 +            ( echo "DROP DATABASE $db_name;"
    3.88 +              echo "DROP TABLESPACE $db_name;"
    3.89 +              echo "DROP ROLE $db_user;"
    3.90 +            ) | PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_sname" -f-
    3.91 +        fi
    3.92 +
    3.93 +        #   remove the generated configuration
    3.94 +        if [ ".$DRUPAL_SETUP_RESTORE" = . ]; then
    3.95 +            rm -f @l_prefix@/share/drupal/sites/default/settings.php
    3.96 +        fi
    3.97 +        ;;
    3.98 +
    3.99 +    backup )
   3.100 +        ##
   3.101 +        ##  backup the database
   3.102 +        ##
   3.103 +
   3.104 +        #   determine dumpfile
   3.105 +        if [ $# -gt 0 ]; then
   3.106 +            #   manually managed dumpfile
   3.107 +            dumpfile="$1"
   3.108 +        else
   3.109 +            #   automatically managed (rotated) dumpfile
   3.110 +            rm -f $db_dump/drupal-dump-9.sql.gz >/dev/null 2>&1 || true
   3.111 +            i=8
   3.112 +            while [ $i -ge 0 ]; do
   3.113 +                if [ -f $db_dump/drupal-dump-$i.sql.bz2 ]; then
   3.114 +                    mv $db_dump/drupal-dump-$i.sql.bz2 $db_dump/drupal-dump-`expr $i + 1`.sql.bz2
   3.115 +                fi
   3.116 +                i=`expr $i - 1`
   3.117 +            done
   3.118 +            dumpfile="$db_dump/drupal-dump-0.sql.bz2"
   3.119 +        fi
   3.120 +
   3.121 +        #   dump database content to dumpfile (compressed plain SQL format)
   3.122 +        umask 007
   3.123 +        if [ ".$db_type" = .mysql ]; then
   3.124 +            @l_prefix@/bin/mysqldump --user="$db_suser" --password="$db_spass" "$db_name" | \
   3.125 +            @l_prefix@/lib/openpkg/bzip2 -9 >$dumpfile
   3.126 +        elif [ ".$db_type" = .pgsql ]; then
   3.127 +            PGPASSWORD="$db_spass" @l_prefix@/bin/pg_dump -U "$db_suser" -S "$db_suser" "$db_name" | \
   3.128 +            @l_prefix@/lib/openpkg/bzip2 -9 >$dumpfile
   3.129 +        fi
   3.130 +        chown @l_rusr@:@l_rgrp@ $dumpfile >/dev/null 2>&1 || true
   3.131 +        chmod 640 $dumpfile >/dev/null 2>&1 || true
   3.132 +        ;;
   3.133 +
   3.134 +    restore )
   3.135 +        ##
   3.136 +        ##  restore the database
   3.137 +        ##
   3.138 +
   3.139 +        #   determine dumpfile
   3.140 +        if [ $# -gt 0 ]; then
   3.141 +            dumpfile="$1"
   3.142 +        else
   3.143 +            dumpfile="0"
   3.144 +        fi
   3.145 +        case "$dumpfile" in
   3.146 +            [0-9] ) dumpfile="$db_dump/drupal-dump-$dumpfile.sql.bz2" ;;
   3.147 +        esac
   3.148 +        if [ ! -f $dumpfile ]; then
   3.149 +            echo "drupal-setup:restore:ERROR: no such dump file: $dumpfile" 1>&2
   3.150 +            exit 1
   3.151 +        fi
   3.152 +
   3.153 +        #   optionally stop Drupal
   3.154 +        eval `@l_prefix@/bin/openpkg rc drupal status 2>/dev/null || true`
   3.155 +        if [ ".$drupal_active" = .yes ]; then
   3.156 +            @l_prefix@/bin/openpkg rc drupal stop >/dev/null 2>&1 || true
   3.157 +        fi
   3.158 +
   3.159 +        #   drop old and initialize new database
   3.160 +        DRUPAL_SETUP_RESTORE=1
   3.161 +        export DRUPAL_SETUP_RESTORE
   3.162 +        $prg uninstall || exit $?
   3.163 +        $prg install   || exit $?
   3.164 +
   3.165 +        #   restore database content from dumpfile (compressed plain SQL format)
   3.166 +        if [ ".$db_type" = .mysql ]; then
   3.167 +            @l_prefix@/lib/openpkg/bzip2 -d -c $dumpfile | \
   3.168 +            @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_name" >/dev/null
   3.169 +        elif [ ".$db_type" = .pgsql ]; then
   3.170 +            @l_prefix@/lib/openpkg/bzip2 -d -c $dumpfile | \
   3.171 +            PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d "$db_name" -f- >/dev/null
   3.172 +        fi
   3.173 +
   3.174 +        #   optionally restart Drupal
   3.175 +        if [ ".$drupal_active" = .yes ]; then
   3.176 +            @l_prefix@/bin/openpkg rc drupal start >/dev/null 2>&1 || true
   3.177 +        fi
   3.178 +        ;;
   3.179 +
   3.180 +    edit )
   3.181 +        ##
   3.182 +        ##  interactively edit the database
   3.183 +        ##
   3.184 +
   3.185 +        if [ ".$db_type" = .mysql ]; then
   3.186 +            @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" "$db_name"
   3.187 +        elif [ ".$db_type" = .pgsql ]; then
   3.188 +            PGPASSWORD="$db_spass" @l_prefix@/bin/psql -U "$db_suser" -d "$db_name"
   3.189 +        fi
   3.190 +        ;;
   3.191 +esac
   3.192 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/drupal/drupal.patch	Tue Aug 28 18:28:45 2012 +0200
     4.3 @@ -0,0 +1,373 @@
     4.4 +Fix Reverse Proxy Support:
     4.5 +http://drupal.org/node/244593
     4.6 +http://drupal.org/files/issues/drupal_80.patch
     4.7 +
     4.8 +Index: includes/bootstrap.inc
     4.9 +--- includes/bootstrap.inc.orig	2008-02-11 15:36:21 +0100
    4.10 ++++ includes/bootstrap.inc	2008-04-09 20:47:49 +0200
    4.11 +@@ -272,6 +272,7 @@
    4.12 +  */
    4.13 + function conf_init() {
    4.14 +   global $base_url, $base_path, $base_root;
    4.15 ++  global $base_url_local;
    4.16 + 
    4.17 +   // Export the following settings.php variables to the global namespace
    4.18 +   global $db_url, $db_prefix, $cookie_domain, $conf, $installed_profile, $update_free_access;
    4.19 +@@ -723,9 +724,22 @@
    4.20 +  * generate an equivalent using other environment variables.
    4.21 +  */
    4.22 + function request_uri() {
    4.23 ++  global $base_url;
    4.24 ++  global $base_url_local;
    4.25 + 
    4.26 +   if (isset($_SERVER['REQUEST_URI'])) {
    4.27 +     $uri = $_SERVER['REQUEST_URI'];
    4.28 ++    if (isset($base_url) && isset($base_url_local)) {
    4.29 ++      $parts = parse_url($base_url_local);
    4.30 ++      if (   strlen($uri) >= strlen($base_url_local)
    4.31 ++          && substr($uri, 0, strlen($base_url_local)) == $base_url_local) {
    4.32 ++        $uri = $base_url .  substr($uri, strlen($base_url_local));
    4.33 ++      }
    4.34 ++      elseif (   strlen($uri) >= strlen($parts["path"])
    4.35 ++          && substr($uri, 0, strlen($parts["path"])) == $parts["path"]) {
    4.36 ++        $uri = $base_url .  substr($uri, strlen($parts["path"]));
    4.37 ++      }
    4.38 ++    }
    4.39 +   }
    4.40 +   else {
    4.41 +     if (isset($_SERVER['argv'])) {
    4.42 +@@ -792,6 +806,7 @@
    4.43 +     }
    4.44 +   }
    4.45 +   // Prevent multiple slashes to avoid cross site requests via the FAPI.
    4.46 ++  if (substr($uri, 0, 1) == "/")
    4.47 +   $uri = '/'. ltrim($uri, '/');
    4.48 + 
    4.49 +   return $uri;
    4.50 +Index: sites/default/default.settings.php
    4.51 +--- sites/default/default.settings.php.orig	2007-12-20 10:35:10 +0100
    4.52 ++++ sites/default/default.settings.php	2008-04-09 20:47:32 +0200
    4.53 +@@ -126,6 +126,24 @@
    4.54 + # $base_url = 'http://www.example.com';  // NO trailing slash!
    4.55 + 
    4.56 + /**
    4.57 ++ * Local Base URL (optional).
    4.58 ++ *
    4.59 ++ * If you are running Drupal behind a reverse proxy, $base_url (see above)
    4.60 ++ * usually points to the URL of the reverse proxy. Drupal uses this for
    4.61 ++ * all sorts of external URLs. In order to correctly calculate sub-URLs
    4.62 ++ * below $base_url for embedded HTML forms, Drupal also has to know the
    4.63 ++ * URL on the local/origin server under which Drupal is contacted by the
    4.64 ++ * reverse proxy. This is what $base_url_local is for.
    4.65 ++ *
    4.66 ++ * Examples:
    4.67 ++ *   $base_url_local = 'http://www.example.com:8080/drupal';
    4.68 ++ *
    4.69 ++ * It is not allowed to have a trailing slash; Drupal will add it
    4.70 ++ * for you.
    4.71 ++ */
    4.72 ++# $base_url_local = 'http://www.example.com:8080/drupal';  // NO trailing slash!
    4.73 ++
    4.74 ++/**
    4.75 +  * PHP settings:
    4.76 +  *
    4.77 +  * To see what PHP settings are possible, including whether they can
    4.78 +
    4.79 +-----------------------------------------------------------------------------
    4.80 +
    4.81 +1. Support HTTP Proxies (mainly for update checks, RSS fetching, etc)
    4.82 +http://drupal.org/node/7881
    4.83 +http://drupal.org/files/issues/proxy_11.patch
    4.84 +(post-adjusted and improved by RSE)
    4.85 +
    4.86 +2. Fix CSS Cache Building Procedure
    4.87 +http://drupal.org/node/275381
    4.88 +http://drupal.org/files/issues/drupal-css-cache-building.patch
    4.89 +(created by RSE)
    4.90 +
    4.91 +Index: includes/common.inc
    4.92 +--- includes/common.inc.orig	2008-04-09 23:11:44 +0200
    4.93 ++++ includes/common.inc	2008-06-26 20:16:16 +0200
    4.94 +@@ -439,13 +439,27 @@
    4.95 +     case 'http':
    4.96 +       $port = isset($uri['port']) ? $uri['port'] : 80;
    4.97 +       $host = $uri['host'] . ($port != 80 ? ':'. $port : '');
    4.98 +-      $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
    4.99 ++      if (variable_get('proxy_server', '') != '') {
   4.100 ++        $proxy_server = variable_get('proxy_server', '');
   4.101 ++        $proxy_port = variable_get('proxy_port', 8080);
   4.102 ++        $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
   4.103 ++      }
   4.104 ++      else {
   4.105 ++        $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
   4.106 ++      }
   4.107 +       break;
   4.108 +     case 'https':
   4.109 +       // Note: Only works for PHP 4.3 compiled with OpenSSL.
   4.110 +       $port = isset($uri['port']) ? $uri['port'] : 443;
   4.111 +       $host = $uri['host'] . ($port != 443 ? ':'. $port : '');
   4.112 +-      $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
   4.113 ++      if (variable_get('proxy_server', '') != '') {
   4.114 ++        $proxy_server = variable_get('proxy_server', '');
   4.115 ++        $proxy_port = variable_get('proxy_port', 8080);
   4.116 ++        $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
   4.117 ++      }
   4.118 ++      else {
   4.119 ++        $fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
   4.120 ++      }
   4.121 +       break;
   4.122 +     default:
   4.123 +       $result->error = 'invalid schema '. $uri['scheme'];
   4.124 +@@ -462,9 +476,14 @@
   4.125 +   }
   4.126 + 
   4.127 +   // Construct the path to act on.
   4.128 +-  $path = isset($uri['path']) ? $uri['path'] : '/';
   4.129 +-  if (isset($uri['query'])) {
   4.130 +-    $path .= '?'. $uri['query'];
   4.131 ++  if (variable_get('proxy_server', '') != '') {
   4.132 ++    $path = $url;
   4.133 ++  }
   4.134 ++  else {
   4.135 ++    $path = isset($uri['path']) ? $uri['path'] : '/';
   4.136 ++    if (isset($uri['query'])) {
   4.137 ++      $path .= '?'. $uri['query'];
   4.138 ++    }
   4.139 +   }
   4.140 + 
   4.141 +   // Create HTTP request.
   4.142 +@@ -482,6 +501,14 @@
   4.143 +     $defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : ''));
   4.144 +   }
   4.145 + 
   4.146 ++  // If the proxy server required a username then attempt to authenticate with it
   4.147 ++  if (variable_get('proxy_username', '') != '') {
   4.148 ++    $username = variable_get('proxy_username', '');
   4.149 ++    $password = variable_get('proxy_password', '');
   4.150 ++    $auth_string = base64_encode($username . ($password != '' ? ':'. $password : ''));
   4.151 ++    $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n";
   4.152 ++  }
   4.153 ++
   4.154 +   foreach ($headers as $header => $value) {
   4.155 +     $defaults[$header] = $header .': '. $value;
   4.156 +   }
   4.157 +Index: modules/system/system.admin.inc
   4.158 +--- modules/system/system.admin.inc.orig	2008-03-25 12:58:16 +0100
   4.159 ++++ modules/system/system.admin.inc	2008-04-24 11:43:07 +0200
   4.160 +@@ -1363,6 +1363,65 @@
   4.161 + }
   4.162 + 
   4.163 + /**
   4.164 ++ * Form builder; Configure the site proxy settings.
   4.165 ++ *
   4.166 ++ * @ingroup forms
   4.167 ++ * @see system_settings_form()
   4.168 ++ */
   4.169 ++function system_proxy_settings() {
   4.170 ++
   4.171 ++  $form['forward_proxy'] = array(
   4.172 ++    '#type' => 'fieldset',
   4.173 ++    '#title' => t('Forward proxy settings'),
   4.174 ++    '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
   4.175 ++  );
   4.176 ++  $form['forward_proxy']['proxy_server'] = array(
   4.177 ++    '#type' => 'textfield',
   4.178 ++    '#title' => t('Proxy host name'),
   4.179 ++    '#default_value' => variable_get('proxy_server', ''),
   4.180 ++    '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
   4.181 ++  );
   4.182 ++  $form['forward_proxy']['proxy_port'] = array(
   4.183 ++    '#type' => 'textfield',
   4.184 ++    '#title' => t('Proxy port number'),
   4.185 ++    '#default_value' => variable_get('proxy_port', 8080),
   4.186 ++    '#description' => t('The port number of the proxy server, eg. 8080'),
   4.187 ++  );
   4.188 ++  $form['forward_proxy']['proxy_username'] = array(
   4.189 ++    '#type' => 'textfield',
   4.190 ++    '#title' => t('Proxy username'),
   4.191 ++    '#default_value' => variable_get('proxy_username', ''),
   4.192 ++    '#description' => t('The username used to authenticate with the proxy server.'),
   4.193 ++  );
   4.194 ++  $form['forward_proxy']['proxy_password'] = array(
   4.195 ++    '#type' => 'textfield',
   4.196 ++    '#title' => t('Proxy password'),
   4.197 ++    '#default_value' => variable_get('proxy_password', ''),
   4.198 ++    '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
   4.199 ++  );
   4.200 ++  $form['#validate'][] = 'system_proxy_settings_validate';
   4.201 ++
   4.202 ++  return system_settings_form($form);
   4.203 ++}
   4.204 ++
   4.205 ++/**
   4.206 ++ * Validate the submitted proxy form.
   4.207 ++ */
   4.208 ++function system_proxy_settings_validate($form, &$form_state) {
   4.209 ++  // Validate the proxy settings
   4.210 ++  $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
   4.211 ++  if ($form_state['values']['proxy_server'] != '') {
   4.212 ++    // TCP allows the port to be between 0 and 65536 inclusive
   4.213 ++    if (!is_numeric($form_state['values']['proxy_port'])) {
   4.214 ++      form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
   4.215 ++    }
   4.216 ++    elseif ($form_state['values']['proxy_port'] < 0 || $form_state['values']['proxy_port'] >= 65536) {
   4.217 ++      form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
   4.218 ++    }
   4.219 ++  }
   4.220 ++}
   4.221 ++
   4.222 ++/**
   4.223 +  * Form builder; Configure the site file handling.
   4.224 +  *
   4.225 +  * @ingroup forms
   4.226 +Index: modules/system/system.module
   4.227 +--- modules/system/system.module.orig	2008-04-09 23:11:49 +0200
   4.228 ++++ modules/system/system.module	2008-04-24 11:43:47 +0200
   4.229 +@@ -55,7 +55,7 @@
   4.230 +       $output .= '<li>'. t('support for enabling and disabling <a href="@themes">themes</a>, which determine the design and presentation of your site. Drupal comes packaged with several core themes and additional contributed themes are available at the <a href="@drupal-themes">Drupal.org theme page</a>.', array('@themes' => url('admin/build/themes'), '@drupal-themes' => 'http://drupal.org/project/themes')) .'</li>';
   4.231 +       $output .= '<li>'. t('a robust <a href="@cache-settings">caching system</a> that allows the efficient re-use of previously-constructed web pages and web page components. Drupal stores the pages requested by anonymous users in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, Drupal\'s caching system may significantly increase the speed of your site.', array('@cache-settings' => url('admin/settings/performance'))) .'</li>';
   4.232 +       $output .= '<li>'. t('a set of routine administrative operations that rely on a correctly-configured <a href="@cron">cron maintenance task</a> to run automatically. A number of other modules, including the feed aggregator, ping module and search also rely on <a href="@cron">cron maintenance tasks</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>.', array('@cron' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron')) .'</li>';
   4.233 +-      $output .= '<li>'. t('basic configuration options for your site, including <a href="@date-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@site-maintenance">site maintenance</a> function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .'</li></ul>';
   4.234 ++      $output .= '<li>'. t('basic configuration options for your site, including <a href="@date-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@proxy-server">proxy server settings</a>, a href="@site-info">site name and other information</a>, and a <a href="@site-maintenance">site maintenance</a> function for taking your site temporarily off-line.', array('@date-settings' => url('admin/settings/date-time'), '@file-system' => url('admin/settings/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@site-maintenance' => url('admin/settings/site-maintenance'))) .'</li></ul>';
   4.235 +       $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/handbook/modules/system/')) .'</p>';
   4.236 +       return $output;
   4.237 +     case 'admin':
   4.238 +@@ -406,6 +406,14 @@
   4.239 +     'access arguments' => array('administer site configuration'),
   4.240 +     'file' => 'system.admin.inc',
   4.241 +   );
   4.242 ++  $items['admin/settings/proxy'] = array(
   4.243 ++    'title' => 'Proxy server',
   4.244 ++    'description' => 'Configure settings when the site is behind a proxy server.',
   4.245 ++    'page callback' => 'drupal_get_form',
   4.246 ++    'page arguments' => array('system_proxy_settings'),
   4.247 ++    'access arguments' => array('administer site configuration'),
   4.248 ++    'file' => 'system.admin.inc',
   4.249 ++  );
   4.250 +   $items['admin/settings/file-system'] = array(
   4.251 +     'title' => 'File system',
   4.252 +     'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
   4.253 +
   4.254 +-----------------------------------------------------------------------------
   4.255 +
   4.256 +Disable "Update notifications" check by default during installation.
   4.257 +
   4.258 +Index: install.php
   4.259 +--- install.php.orig	2008-02-08 23:00:45 +0100
   4.260 ++++ install.php	2008-05-09 13:18:09 +0200
   4.261 +@@ -1069,7 +1069,7 @@
   4.262 +     '#type' => 'checkboxes',
   4.263 +     '#title' => st('Update notifications'),
   4.264 +     '#options' => array(1 => st('Check for updates automatically')),
   4.265 +-    '#default_value' => array(1),
   4.266 ++    '#default_value' => array(),
   4.267 +     '#description' => st('With this option enabled, Drupal will notify you when new releases are available. This will significantly enhance your site\'s security and is <strong>highly recommended</strong>. This requires your site to periodically send anonymous information on its installed components to <a href="@drupal">drupal.org</a>. For more information please see the <a href="@update">update notification information</a>.', array('@drupal' => 'http://drupal.org', '@update' => 'http://drupal.org/handbook/modules/update')),
   4.268 +     '#weight' => 15,
   4.269 +   );
   4.270 +
   4.271 +-----------------------------------------------------------------------------
   4.272 +
   4.273 +No need to always expand the "Menu settings" on node edit pages.
   4.274 +
   4.275 +Index: modules/menu/menu.module
   4.276 +--- modules/menu/menu.module.orig	2008-04-09 23:11:48 +0200
   4.277 ++++ modules/menu/menu.module	2008-05-16 20:03:48 +0200
   4.278 +@@ -366,7 +366,7 @@
   4.279 +       '#title' => t('Menu settings'),
   4.280 +       '#access' => user_access('administer menu'),
   4.281 +       '#collapsible' => TRUE,
   4.282 +-      '#collapsed' => FALSE,
   4.283 ++      '#collapsed' => TRUE,
   4.284 +       '#tree' => TRUE,
   4.285 +       '#weight' => -2,
   4.286 +       '#attributes' => array('class' => 'menu-item-form'),
   4.287 +
   4.288 +-----------------------------------------------------------------------------
   4.289 +
   4.290 +Use a larger text-area on node edit pages.
   4.291 +
   4.292 +Index: modules/node/node.pages.inc
   4.293 +--- modules/node/node.pages.inc.orig	2008-02-27 20:44:44 +0100
   4.294 ++++ modules/node/node.pages.inc	2008-05-16 20:06:45 +0200
   4.295 +@@ -287,7 +287,8 @@
   4.296 +     '#type' => 'textarea',
   4.297 +     '#title' => check_plain($label),
   4.298 +     '#default_value' => $include ? $node->body : ($node->teaser . $node->body),
   4.299 +-    '#rows' => 20,
   4.300 ++    '#rows' => 30,
   4.301 ++    '#cols' => 80,
   4.302 +     '#required' => ($word_count > 0),
   4.303 +   );
   4.304 + 
   4.305 +-----------------------------------------------------------------------------
   4.306 +
   4.307 +Avoid incorrect ordering of BLOG entries by removing the
   4.308 +db_rewrite_sql() calls which seem to introduce a wrong ordering.
   4.309 +
   4.310 +Index: modules/blog/blog.module
   4.311 +--- modules/blog/blog.module.orig	2008-05-19 09:27:35 +0200
   4.312 ++++ modules/blog/blog.module	2008-07-29 21:20:42 +0200
   4.313 +@@ -182,13 +182,13 @@
   4.314 +  * Helper function to determine if a user has blog posts already.
   4.315 +  */
   4.316 + function _blog_post_exists($account) {
   4.317 +-  return (bool)db_result(db_query_range(db_rewrite_sql("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1"), $account->uid, 0, 1));
   4.318 ++  return (bool)db_result(db_query_range("SELECT 1 FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1", $account->uid, 0, 1));
   4.319 + }
   4.320 + 
   4.321 + /**
   4.322 +  * Implementation of hook_block().
   4.323 +  *
   4.324 +- * Displays the most recent 10 blog titles.
   4.325 ++ * Displays the most recent 5 blog titles.
   4.326 +  */
   4.327 + function blog_block($op = 'list', $delta = 0) {
   4.328 +   global $user;
   4.329 +@@ -198,7 +198,7 @@
   4.330 +   }
   4.331 +   else if ($op == 'view') {
   4.332 +     if (user_access('access content')) {
   4.333 +-      $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10);
   4.334 ++      $result = db_query_range("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC", 0, 5);
   4.335 +       if ($node_title_list = node_title_list($result)) {
   4.336 +         $block['content'] = $node_title_list;
   4.337 +         $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.'));
   4.338 +Index: modules/blog/blog.pages.inc
   4.339 +--- modules/blog/blog.pages.inc.orig	2009-09-14 17:08:00 +0200
   4.340 ++++ modules/blog/blog.pages.inc	2009-09-19 08:53:18 +0200
   4.341 +@@ -25,7 +25,7 @@
   4.342 + 
   4.343 +   $output = theme('item_list', $items);
   4.344 + 
   4.345 +-  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
   4.346 ++  $result = pager_query("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC", variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
   4.347 +   $has_posts = FALSE;
   4.348 +   
   4.349 +   while ($node = db_fetch_object($result)) {
   4.350 +@@ -64,7 +64,7 @@
   4.351 + 
   4.352 +   $output = theme('item_list', $items);
   4.353 + 
   4.354 +-  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10));
   4.355 ++  $result = pager_query("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC", variable_get('default_nodes_main', 10));
   4.356 +   $has_posts = FALSE;
   4.357 + 
   4.358 +   while ($node = db_fetch_object($result)) {
   4.359 +@@ -87,7 +87,7 @@
   4.360 +  * Menu callback; displays an RSS feed containing recent blog entries of a given user.
   4.361 +  */
   4.362 + function blog_feed_user($account) {
   4.363 +-  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n  WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10));
   4.364 ++  $result = db_query_range("SELECT n.nid, n.created FROM {node} n  WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC", $account->uid, 0, variable_get('feed_default_items', 10));
   4.365 +   $channel['title'] = t("!name's blog", array('!name' => $account->name));
   4.366 +   $channel['link'] = url('blog/'. $account->uid, array('absolute' => TRUE));
   4.367 + 
   4.368 +@@ -102,7 +102,7 @@
   4.369 +  * Menu callback; displays an RSS feed containing recent blog entries of all users.
   4.370 +  */
   4.371 + function blog_feed_last() {
   4.372 +-  $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
   4.373 ++  $result = db_query_range("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC", 0, variable_get('feed_default_items', 10));
   4.374 +   $channel['title'] = t('!site_name blogs', array('!site_name' => variable_get('site_name', 'Drupal')));
   4.375 +   $channel['link'] = url('blog', array('absolute' => TRUE));
   4.376 + 
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/drupal/drupal.spec	Tue Aug 28 18:28:45 2012 +0200
     5.3 @@ -0,0 +1,268 @@
     5.4 +##
     5.5 +##  drupal.spec -- OpenPKG RPM Package Specification
     5.6 +##  Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
     5.7 +##
     5.8 +##  Permission to use, copy, modify, and distribute this software for
     5.9 +##  any purpose with or without fee is hereby granted, provided that
    5.10 +##  the above copyright notice and this permission notice appear in all
    5.11 +##  copies.
    5.12 +##
    5.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    5.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    5.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    5.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    5.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    5.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    5.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    5.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    5.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    5.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    5.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    5.24 +##  SUCH DAMAGE.
    5.25 +##
    5.26 +
    5.27 +#   package information
    5.28 +Name:         drupal
    5.29 +Summary:      Content Management Platform
    5.30 +URL:          http://www.drupal.org/
    5.31 +Vendor:       Dries Buytaert et al.
    5.32 +Packager:     OpenPKG Foundation e.V.
    5.33 +Distribution: OpenPKG Community
    5.34 +Class:        PLUS
    5.35 +Group:        CMS
    5.36 +License:      GPL
    5.37 +Version:      6.22
    5.38 +Release:      20110526
    5.39 +
    5.40 +#   package options
    5.41 +%option       with_mysql   yes
    5.42 +%option       with_pgsql   no
    5.43 +%option       with_dcron   no
    5.44 +
    5.45 +#   checking for option conflicts
    5.46 +%if "%{with_mysql}" == "no" && "%{with_pgsql}" == "no"
    5.47 +    %{error:one of the build-time options 'with_mysql' or 'with_pgsql' have to be enabled}
    5.48 +%endif
    5.49 +%if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
    5.50 +    %{error:only one of the build-time options 'with_mysql' or 'with_pgsql' can be enabled at a time}
    5.51 +%endif
    5.52 +
    5.53 +#   list of sources
    5.54 +Source0:      http://ftp.drupal.org/files/projects/drupal-%{version}.tar.gz
    5.55 +Source1:      drupal-setup.sh
    5.56 +Source2:      drupal-cron.sh
    5.57 +Source3:      drupal-apache.conf
    5.58 +Source4:      rc.drupal
    5.59 +Patch0:       drupal.patch
    5.60 +
    5.61 +#   build information
    5.62 +BuildPreReq:  OpenPKG, openpkg >= 20100101, infozip
    5.63 +PreReq:       OpenPKG, openpkg >= 20100101
    5.64 +PreReq:       pcre, pcre::with_utf8
    5.65 +PreReq:       apache
    5.66 +PreReq:       apache::with_mod_deflate = yes
    5.67 +PreReq:       apache-php
    5.68 +PreReq:       apache-php::with_ctype = yes
    5.69 +PreReq:       apache-php::with_gd = yes
    5.70 +PreReq:       apache-php::with_mbstring = yes
    5.71 +PreReq:       apache-php::with_session = yes
    5.72 +PreReq:       apache-php::with_mm = yes
    5.73 +PreReq:       apache-php::with_xml = yes
    5.74 +PreReq:       apache-php::with_xslt = yes
    5.75 +PreReq:       apache-php::with_sendmail = yes
    5.76 +%if "%{with_mysql}" == "yes"
    5.77 +PreReq:       apache-php::with_mysql = yes
    5.78 +%endif
    5.79 +%if "%{with_pgsql}" == "yes"
    5.80 +PreReq:       apache-php::with_pgsql = yes
    5.81 +%endif
    5.82 +%if "%{with_dcron}" == "yes"
    5.83 +PreReq:       dcron
    5.84 +%endif
    5.85 +PreReq:       MTA
    5.86 +
    5.87 +%description
    5.88 +    Drupal is a dynamic web site platform which allows an individual
    5.89 +    or community of users to publish, manage and organize a
    5.90 +    variety of content, Drupal integrates many popular features of
    5.91 +    content management systems, weblogs, collaborative tools and
    5.92 +    discussion-based community software into one easy-to-use package.
    5.93 +
    5.94 +%track
    5.95 +    prog drupal = {
    5.96 +        version   = %{version}
    5.97 +        url       = http://ftp.drupal.org/files/projects/
    5.98 +        regex     = drupal-(6\.\d+)\.tar\.gz
    5.99 +    }
   5.100 +
   5.101 +%prep
   5.102 +    #   unpack core distribution
   5.103 +    %setup -q -n drupal-%{version}
   5.104 +
   5.105 +    #   apply local patches
   5.106 +    %patch -p0
   5.107 +
   5.108 +%build
   5.109 +
   5.110 +%install
   5.111 +    #   create installation hierarchy
   5.112 +    %{l_shtool} mkdir -f -p -m 755 \
   5.113 +        $RPM_BUILD_ROOT%{l_prefix}/sbin \
   5.114 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   5.115 +        $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/sites \
   5.116 +        $RPM_BUILD_ROOT%{l_prefix}/share/drupal \
   5.117 +        $RPM_BUILD_ROOT%{l_prefix}/var/drupal/files \
   5.118 +        $RPM_BUILD_ROOT%{l_prefix}/var/drupal/run \
   5.119 +        $RPM_BUILD_ROOT%{l_prefix}/var/drupal/log \
   5.120 +        $RPM_BUILD_ROOT%{l_prefix}/var/drupal/dump \
   5.121 +        $RPM_BUILD_ROOT%{l_prefix}/var/drupal/db
   5.122 +
   5.123 +    #   avoid copying unnecessary text files
   5.124 +    find . -name "*.orig" -print | xargs rm -f
   5.125 +    rm -f CHANGELOG.txt COPYRIGHT.txt INSTALL.*.txt INSTALL.txt
   5.126 +    rm -f LICENSE.txt MAINTAINERS.txt UPGRADE.txt
   5.127 +
   5.128 +    #   install all files (and strip down installation afterwards)
   5.129 +    cp -rp * .htaccess \
   5.130 +        $RPM_BUILD_ROOT%{l_prefix}/share/drupal/
   5.131 +
   5.132 +    #   pre-configure settings.php
   5.133 +    %{l_shtool} subst \
   5.134 +%if "%{with_mysql}" == "yes"
   5.135 +        -e 's|^\( *\$db_url\) *=.*$|\1 = "mysql://drupal:drupal@127.0.0.1/drupal";|' \
   5.136 +%endif
   5.137 +%if "%{with_pgsql}" == "yes"
   5.138 +        -e 's|^\( *\$db_url\) *=.*$|\1 = "pgsql://drupal:drupal@127.0.0.1/drupal";|' \
   5.139 +%endif
   5.140 +        $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/default.settings.php
   5.141 +
   5.142 +    #   set data location
   5.143 +    ln -s ../../../../var/drupal/files \
   5.144 +        $RPM_BUILD_ROOT%{l_prefix}/share/drupal/sites/default/files
   5.145 +
   5.146 +    #   install run-command script
   5.147 +%if "%{with_dcron}" == "yes"
   5.148 +    l_drupal_cron="no"
   5.149 +%else
   5.150 +    l_drupal_cron="yes"
   5.151 +%endif
   5.152 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   5.153 +        -e "s;@l_drupal_cron@;$l_drupal_cron;g" \
   5.154 +        %{SOURCE rc.drupal} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   5.155 +
   5.156 +    #   install database setup script
   5.157 +%if "%{with_mysql}" == "yes"
   5.158 +    l_dbtype="mysql"
   5.159 +%endif
   5.160 +%if "%{with_pgsql}" == "yes"
   5.161 +    l_dbtype="pgsql"
   5.162 +%endif
   5.163 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   5.164 +        -e "s;@l_dbtype@;$l_dbtype;g" \
   5.165 +        -e "s;@l_bash@;%{l_bash};g" \
   5.166 +        %{SOURCE drupal-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-setup
   5.167 +
   5.168 +    #   install crond(8) job script
   5.169 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   5.170 +        %{SOURCE drupal-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/drupal-cron
   5.171 +%if "%{with_dcron}" == "yes"
   5.172 +    %{l_shtool} mkdir -f -p -m 755 \
   5.173 +        $RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs
   5.174 +    echo "*/5 * * * * su %{l_rusr} -c %{l_prefix}/sbin/drupal-cron" \
   5.175 +        >$RPM_BUILD_ROOT%{l_prefix}/etc/dcron/crontabs/drupal
   5.176 +%endif
   5.177 +
   5.178 +    #   install custom Apache configuration
   5.179 +    l_hostname=`%{l_shtool} echo -e %h`
   5.180 +    l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
   5.181 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   5.182 +        -e "s;@l_hostname@;$l_hostname;g" \
   5.183 +        -e "s;@l_domainname@;$l_domainname;g" \
   5.184 +        %{SOURCE drupal-apache.conf} \
   5.185 +        $RPM_BUILD_ROOT%{l_prefix}/etc/drupal/
   5.186 +
   5.187 +    #   determine installation files
   5.188 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   5.189 +        %{l_files_std} \
   5.190 +        '%config %{l_prefix}/etc/drupal' \
   5.191 +%if "%{with_dcron}" == "yes"
   5.192 +        '%not %dir %{l_prefix}/etc/dcron' \
   5.193 +        '%not %dir %{l_prefix}/etc/dcron/crontabs' \
   5.194 +        '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dcron/crontabs/drupal' \
   5.195 +%endif
   5.196 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal' \
   5.197 +        '%attr(555,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/drupal/sites/default' \
   5.198 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/drupal'
   5.199 +
   5.200 +%files -f files
   5.201 +
   5.202 +%clean
   5.203 +
   5.204 +%post
   5.205 +    if [ $1 -eq 1 ]; then
   5.206 +        #   display final hints on initial installation
   5.207 +        ( echo "1. To complete this installation of Drupal please start the RDBMS"
   5.208 +          echo "   and initialize the Drupal database like this:"
   5.209 +%if "%{with_mysql}" == "yes"
   5.210 +          echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
   5.211 +%endif
   5.212 +%if "%{with_pgsql}" == "yes"
   5.213 +          echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
   5.214 +%endif
   5.215 +          echo "     \$ $RPM_INSTALL_PREFIX/sbin/drupal-setup install"
   5.216 +          echo ""
   5.217 +          echo "2. Now start Drupal by running the command"
   5.218 +          echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc drupal start"
   5.219 +          echo "   and connect with a browser to the URL:"
   5.220 +          echo "     http://127.0.0.1:8080/drupal/install.php"
   5.221 +          echo "   Follow the instructions. On the page \"Database configuration\""
   5.222 +%if "%{with_mysql}" == "yes"
   5.223 +          echo "   use database type \"mysql\", database name \"drupal\", database"
   5.224 +%endif
   5.225 +%if "%{with_pgsql}" == "yes"
   5.226 +          echo "   use database type \"pgsql\", database name \"drupal\", database"
   5.227 +%endif
   5.228 +          echo "   username \"drupal\" and database password \"drupal\". Also create"
   5.229 +          echo "   an account and login. The first account will automatically become"
   5.230 +          echo "   the main administrator account with total control over Drupal."
   5.231 +          echo ""
   5.232 +          echo "3. By default, Drupal runs its own Apache server on IPv4 address"
   5.233 +          echo "   127.0.0.1, TCP port 8080. Please change this by editing the"
   5.234 +          echo "   \"Listen 127.0.0.1:8080\" directive in"
   5.235 +          echo "     $RPM_INSTALL_PREFIX/etc/drupal/drupal-apache.conf"
   5.236 +          echo "   Also do not forget to cp -p"
   5.237 +          echo " $RPM_INSTALL_PREFIX/share/drupal/sites/default/settings.php"
   5.238 +          echo "     $RPM_INSTALL_PREFIX/share/drupal/sites/settings.php"
   5.239 +          echo "   and adjust the \$base_url variable."
   5.240 +          echo ""
   5.241 +          echo "4. Access Drupal via:"
   5.242 +          echo "     http://127.0.0.1:8080/drupal/      (website view)"
   5.243 +          echo "     http://127.0.0.1:8080/drupal/admin (website admin)"
   5.244 +        ) | %{l_rpmtool} msg -b -t notice
   5.245 +    fi
   5.246 +    if [ $1 -eq 2 ]; then
   5.247 +        #   display final hints on update installation
   5.248 +        ( echo "Please perform a Drupal database upgrade by visiting the"
   5.249 +          echo "     http://127.0.0.1:8080/drupal/update.php"
   5.250 +          echo "page on your Drupal website."
   5.251 +        ) | %{l_rpmtool} msg -b -t notice
   5.252 +
   5.253 +        #   after upgrade, restart service
   5.254 +        eval `%{l_rc} drupal status 2>/dev/null`
   5.255 +        [ ".$drupal_active" = .yes ] && %{l_rc} drupal restart
   5.256 +    fi
   5.257 +    exit 0
   5.258 +
   5.259 +%preun
   5.260 +    if [ $1 -eq 0 ]; then
   5.261 +        #   before erase, stop service and remove log files
   5.262 +        %{l_rc} drupal stop 2>/dev/null
   5.263 +        $RPM_INSTALL_PREFIX/sbin/drupal-setup uninstall >/dev/null 2>&1 || true
   5.264 +        rm -f $RPM_INSTALL_PREFIX/var/drupal/files/* >/dev/null 2>&1 || true
   5.265 +        rm -f $RPM_INSTALL_PREFIX/var/drupal/log/*   >/dev/null 2>&1 || true
   5.266 +        rm -f $RPM_INSTALL_PREFIX/var/drupal/run/*   >/dev/null 2>&1 || true
   5.267 +        rm -f $RPM_INSTALL_PREFIX/var/drupal/dump/*  >/dev/null 2>&1 || true
   5.268 +        rm -f $RPM_INSTALL_PREFIX/var/drupal/db/*    >/dev/null 2>&1 || true
   5.269 +    fi
   5.270 +    exit 0
   5.271 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/drupal/rc.drupal	Tue Aug 28 18:28:45 2012 +0200
     6.3 @@ -0,0 +1,65 @@
     6.4 +#!@l_prefix@/bin/openpkg rc
     6.5 +##
     6.6 +##  rc.drupal -- Run-Commands
     6.7 +##
     6.8 +
     6.9 +%config
    6.10 +    drupal_enable="$openpkg_rc_def"
    6.11 +    drupal_cron="@l_drupal_cron@"
    6.12 +    drupal_backup="daily"
    6.13 +
    6.14 +%status -u @l_susr@ -o
    6.15 +    drupal_usable="no"
    6.16 +    drupal_active="no"
    6.17 +    @l_prefix@/sbin/apache -t \
    6.18 +        -f @l_prefix@/etc/drupal/drupal-apache.conf 2>/dev/null && \
    6.19 +        drupal_usable="yes"
    6.20 +    [ -f @l_prefix@/var/drupal/run/apache.pid ] && \
    6.21 +        kill -0 `cat @l_prefix@/var/drupal/run/apache.pid` && \
    6.22 +        drupal_active="yes"
    6.23 +    echo "drupal_enable=\"$drupal_enable\""
    6.24 +    echo "drupal_usable=\"$drupal_usable\""
    6.25 +    echo "drupal_active=\"$drupal_active\""
    6.26 +
    6.27 +%start -u @l_susr@
    6.28 +    rcService drupal enable yes || exit 0
    6.29 +    rcService drupal active yes && exit 0
    6.30 +    @l_prefix@/sbin/apache \
    6.31 +        -f @l_prefix@/etc/drupal/drupal-apache.conf
    6.32 +
    6.33 +%stop -u @l_susr@
    6.34 +    rcService drupal enable yes || exit 0
    6.35 +    rcService drupal active no  && exit 0
    6.36 +    [ -f @l_prefix@/var/drupal/run/apache.pid ] && \
    6.37 +        kill -TERM `cat @l_prefix@/var/drupal/run/apache.pid`
    6.38 +    sleep 2
    6.39 +
    6.40 +%restart -u @l_susr@
    6.41 +    rcService drupal enable yes || exit 0
    6.42 +    rcService drupal active no  && exit 0
    6.43 +    rc drupal stop start
    6.44 +
    6.45 +%quarterly -u @l_rusr@
    6.46 +    rcService drupal enable yes || exit 0
    6.47 +    if [ ".$drupal_cron" = .yes ]; then
    6.48 +        @l_prefix@/sbin/drupal-cron
    6.49 +    fi
    6.50 +
    6.51 +%hourly -u @l_rusr@
    6.52 +    rcService drupal enable yes || exit 0
    6.53 +    if [ ".$drupal_backup" = .hourly ]; then
    6.54 +        @l_prefix@/sbin/drupal-setup backup || exit $?
    6.55 +    fi
    6.56 +
    6.57 +%daily -u @l_rusr@
    6.58 +    rcService drupal enable yes || exit 0
    6.59 +    if [ ".$drupal_backup" = .daily ]; then
    6.60 +        @l_prefix@/sbin/drupal-setup backup || exit $?
    6.61 +    fi
    6.62 +
    6.63 +%weekly -u @l_rusr@
    6.64 +    rcService drupal enable yes || exit 0
    6.65 +    if [ ".$drupal_backup" = .weekly ]; then
    6.66 +        @l_prefix@/sbin/drupal-setup backup || exit $?
    6.67 +    fi
    6.68 +

mercurial