##
## wordpress.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2007 OpenPKG Foundation e.V.
## Copyright (c) 2000-2007 Ralf S. Engelschall
##
## 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 Foundation e.V.
Distribution: OpenPKG Community
Class: PLUS
Group: CMS
License: GPL
Version: 2.1
Release: 20070213
# 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: wordpress-cron.sh
Source4: rc.wordpress
Patch0: wordpress.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20060823
PreReq: OpenPKG, openpkg >= 20060823
PreReq: apache, wget
PreReq: apache::with_mod_php = yes
PreReq: apache::with_mod_php_mysql = yes
PreReq: apache::with_mod_php_pcre = yes
PreReq: apache::with_mod_php_sendmail = 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
%patch -p0
%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 \
$RPM_BUILD_ROOT%{l_prefix}/var/wordpress/tmp
# install program files
cp -rp * $RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/
# create additional uploads directory
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/libexec/wordpress/wp-content/uploads
# 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 cron-job script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE wordpress-cron.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/wordpress-cron
# 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/*' \
'%attr(-,%{l_rusr},%{l_ngrp}) %{l_prefix}/libexec/wordpress/wp-content/uploads'
%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