ソースを参照

new package: wordpress 1.5.1.3 (Weblog Publishing System)

Ralf S. Engelschall 20 年 前
コミット
ac1ec33c37
4 ファイル変更321 行追加0 行削除
  1. 42 0
      wordpress/rc.wordpress
  2. 102 0
      wordpress/wordpress-apache.conf
  3. 16 0
      wordpress/wordpress-setup.sh
  4. 161 0
      wordpress/wordpress.spec

+ 42 - 0
wordpress/rc.wordpress

@@ -0,0 +1,42 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.wordpress -- Run-Commands
+##
+
+%config
+    wordpress_enable="$openpkg_rc_def"
+    wordpress_cron="yes"
+
+%common
+    wordpress_apache_cfgfile="@l_prefix@/etc/wordpress/wordpress-apache.conf"
+    wordpress_apache_pidfile="@l_prefix@/var/wordpress/wordpress-apache.pid"
+
+%status -u @l_susr@ -o
+    wordpress_usable="no"
+    wordpress_active="no"
+    @l_prefix@/sbin/apache -t -f $wordpress_apache_cfgfile 2>/dev/null && \
+        wordpress_usable="yes"
+    [ -f $wordpress_apache_pidfile ] && \
+        kill -0 `cat $wordpress_apache_pidfile` && \
+        wordpress_active="yes"
+    echo "wordpress_enable=\"$wordpress_enable\""
+    echo "wordpress_usable=\"$wordpress_usable\""
+    echo "wordpress_active=\"$wordpress_active\""
+
+%start -u @l_susr@
+    rcService wordpress enable yes || exit 0
+    rcService wordpress active yes && exit 0
+    @l_prefix@/sbin/apache -f $wordpress_apache_cfgfile
+
+%stop -u @l_susr@
+    rcService wordpress enable yes || exit 0
+    rcService wordpress active no  && exit 0
+    [ -f $wordpress_apache_pidfile ] && \
+        kill -TERM `cat $wordpress_apache_pidfile`
+    sleep 2
+
+%restart -u @l_susr@
+    rcService wordpress enable yes || exit 0
+    rcService wordpress active no  && exit 0
+    rc wordpress stop start
+

+ 102 - 0
wordpress/wordpress-apache.conf

@@ -0,0 +1,102 @@
+##
+##  wordpress-apache.conf -- Wordpress Apache Custom Configuration
+##
+
+ServerType             standalone
+ServerRoot             @l_prefix@
+ServerAdmin            root@@l_hostname@.@l_domainname@
+ServerName             @l_hostname@.@l_domainname@
+ServerTokens           Prod
+User                   @l_rusr@
+Group                  @l_rgrp@
+Port                   8080
+Listen                 127.0.0.1:8081
+
+#   runtime files
+PidFile                @l_prefix@/var/wordpress/wordpress-apache.pid
+ScoreBoardFile         @l_prefix@/var/wordpress/wordpress-apache.sb
+LockFile               @l_prefix@/var/wordpress/wordpress-apache.lck
+
+#  server behaviour
+Timeout                300
+KeepAlive              on
+MaxKeepAliveRequests   100
+KeepAliveTimeout       15
+MinSpareServers        5
+MaxSpareServers        10
+StartServers           5
+MaxClients             15
+MaxRequestsPerChild    500
+HostnameLookups        off
+UseCanonicalName       on
+
+#   access logging
+LogFormat              "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat              "%h %l %u %t \"%r\" %>s %b" common
+LogFormat              "%{Referer}i -> %U" referer
+LogFormat              "%{User-agent}i" agent
+CustomLog              @l_prefix@/var/wordpress/wordpress-apache.access.log common
+
+#   error logging
+LogLevel               warn
+ErrorLog               @l_prefix@/var/wordpress/wordpress-apache.error.log
+ServerSignature        on
+
+#   secure root directory
+<Directory />
+    Options FollowSymLinks
+    AllowOverride None
+</Directory>
+
+#   browser specifics
+BrowserMatch "Mozilla/2"       nokeepalive
+BrowserMatch "MSIE 4\.0b2;"    nokeepalive downgrade-1.0 force-response-1.0
+BrowserMatch "RealPlayer 4\.0" force-response-1.0
+BrowserMatch "Java/1\.0"       force-response-1.0
+BrowserMatch "JDK/1\.0"        force-response-1.0
+
+#   SSL/TLS support
+<IfModule mod_ssl.c>
+    SSLRandomSeed           startup builtin
+    SSLRandomSeed           connect builtin
+    SSLMutex                sem
+    SSLSessionCache         shmcb:@l_prefix@/var/wordpress/wordpress-apache.scache(512000)
+    SSLSessionCacheTimeout  300
+    SSLLog                  @l_prefix@/var/wordpress/wordpress-apache.ssl.log
+    SSLLogLevel             warn
+    SSLCipherSuite          ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+    SetEnvIf User-Agent ".*MSIE.*" \
+             nokeepalive ssl-unclean-shutdown \
+             downgrade-1.0 force-response-1.0
+    <Files ~ "\.(cgi|shtml|phtml|php?)$">
+        SSLOptions +StdEnvVars
+    </Files>
+    <Directory "@l_prefix@/cgi">
+        SSLOptions +StdEnvVars
+    </Directory>
+</IfModule>
+
+#   configure Drupal
+AddType           application/x-httpd-php .php
+php_admin_flag    magic_quotes_gpc   0
+php_admin_flag    register_globals   0
+php_admin_flag    session.auto_start 0
+DocumentRoot      @l_prefix@/libexec/wordpress
+DirectoryIndex    index.php
+ErrorDocument     404 /index.php
+ExpiresByType     text/html A1
+<Directory        "@l_prefix@/libexec/wordpress">
+    Options       -Indexes +FollowSymLinks
+    AllowOverride None
+    Order         allow,deny
+    Allow         from all
+    RewriteEngine on
+    RewriteCond   %{REQUEST_FILENAME} !-f
+    RewriteCond   %{REQUEST_FILENAME} !-d
+    RewriteRule   ^(.*)$ index.php?q=$1 [L,QSA]
+    <Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
+        Order     deny,allow
+        Deny      from all
+    </Files>
+</Directory>
+

+ 16 - 0
wordpress/wordpress-setup.sh

@@ -0,0 +1,16 @@
+#!/bin/sh
+##
+##  wordpress-setup
+##
+
+#   determine MySQL root password
+password=`grep "^password" @l_prefix@/etc/mysql/my.pwd |\
+          sed -e 's;^password[^=]*= *;;' -e 's; *$;;'`
+
+#   create the MySQL database for Wordpress
+@l_prefix@/bin/mysqladmin --user=root --password=$password create wordpress
+@l_prefix@/bin/mysql --user=root --password=$password mysql <<EOF
+GRANT ALL ON wordpress.* TO wordpress@localhost IDENTIFIED BY 'wordpress';
+FLUSH PRIVILEGES;
+EOF
+

+ 161 - 0
wordpress/wordpress.spec

@@ -0,0 +1,161 @@
+##
+##  wordpress.spec -- OpenPKG RPM Package Specification
+##  Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
+##  Copyright (c) 2000-2005 Ralf S. Engelschall <http://engelschall.com/>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+##  SUCH DAMAGE.
+##
+
+#   package information
+Name:         wordpress
+Summary:      Weblog Publishing System
+URL:          http://www.wordpress.org/
+Vendor:       R. Boren & M. Mullenweg et al.
+Packager:     OpenPKG
+Distribution: OpenPKG
+Class:        EVAL
+Group:        Web
+License:      GPL
+Version:      1.5.1.3
+Release:      20050727
+
+#   list of sources
+Source0:      ftp://ftp.openpkg.org/sources/CPY/VERSIONED/wordpress/wordpress-%{version}.tar.gz
+Source1:      wordpress-apache.conf
+Source2:      wordpress-setup.sh
+Source3:      rc.wordpress
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20040130
+PreReq:       OpenPKG, openpkg >= 20040130
+PreReq:       apache
+PreReq:       apache::with_mod_php = yes
+PreReq:       apache::with_mod_php_mysql = yes
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    WordPress is a state-of-the-art semantic personal publishing
+    platform (aka Weblog or BLOG) with a focus on aesthetics, web
+    standards, and usability.
+
+%track
+    prog wordpress = {
+        version   = %{version}
+        url       = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/wordpress/
+        regex     = wordpress-(__VER__)\.tar\.gz
+    }
+
+%prep
+    %setup -q -n wordpress
+
+%build
+    #   create configuration file
+    %{l_shtool} install -m 644 \
+        -e 's;username;wordpress;' \
+        -e 's;password;wordpress;' \
+        wp-config-sample.php wp-config.php
+
+%install
+    #   create installation hierarchy
+    rm -rf $RPM_BUILD_ROOT
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
+        $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress \
+        $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/run \
+        $RPM_BUILD_ROOT%{l_prefix}/var/wordpress/log
+
+    #   install program files
+    cp -rp * $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/
+
+    #   install run-command script
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.wordpress} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   install MySQL database setup script
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE wordpress-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-setup
+
+    #   install custom Apache configuration
+    l_hostname=`%{l_shtool} echo -e %h`
+    l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
+    %{l_shtool} install -c -m 644 %{l_value -s -a} \
+        -e "s;@l_hostname@;$l_hostname;g" \
+        -e "s;@l_domainname@;$l_domainname;g" \
+        %{SOURCE wordpress-apache.conf} \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/wordpress/
+
+    #   determine installation files
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+        %{l_files_std} \
+        '%config %{l_prefix}/etc/wordpress/*' \
+        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress' \
+        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/wordpress/*'
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+
+%post
+    if [ $1 -eq 1 ]; then
+        #   display final hints on initial installation
+        ( echo "1. To complete this installation of Wordpress please start MySQL and"
+          echo "   initialize the Wordpress database like this:"
+          echo "     \$ $RPM_INSTALL_PREFIX/etc/rc mysql start"
+          echo "     \$ $RPM_INSTALL_PREFIX/sbin/wordpress-setup"
+          echo ""
+          echo "3. By default, Wordpress runs its own Apache server on IPv4 address"
+          echo "   127.0.0.1, TCP port 8081. Please change this by editing the"
+          echo "   \"Port 8081\" and \"Listen 127.0.0.1:8081\" directives in"
+          echo "   $RPM_INSTALL_PREFIX/etc/wordpress/wordpress-apache.conf"
+          echo ""
+          echo "4. After this postinstallation, start Wordpress by running"
+          echo "     \$ $RPM_INSTALL_PREFIX/etc/rc wordpress start"
+          echo "   and initialize the Wordpress database by connecting to:"
+          echo "     http://127.0.0.1:8081/wp-admin/wp-install.php"
+        ) | %{l_rpmtool} msg -b -t notice
+    fi
+    if [ $1 -eq 2 ]; then
+        #   display final hints on update installation
+        ( echo "Please perform a Wordpress database upgrade by visiting the"
+          echo "     http://127.0.0.1:8081/wp-admin/upgrade.php"
+          echo "page on your Wordpress website."
+        ) | %{l_rpmtool} msg -b -t notice
+
+        #   after upgrade, restart service
+        eval `%{l_rc} wordpress status 2>/dev/null`
+        [ ".$wordpress_active" = .yes ] && %{l_rc} wordpress restart
+    fi
+    exit 0
+
+%preun
+    if [ $1 -eq 0 ]; then
+        #   before erase, stop service and remove log files
+        %{l_rc} wordpress stop 2>/dev/null
+        rm -f $RPM_INSTALL_PREFIX/var/wordpress/log/* >/dev/null 2>&1 || true
+        rm -f $RPM_INSTALL_PREFIX/var/wordpress/run/* >/dev/null 2>&1 || true
+    fi
+    exit 0
+