##
## joomla.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 version
%define V_dist 1.5.Beta2
%define V_opkg 1.5b2
# package information
Name: joomla
Summary: Content Management System (CMS)
URL: http://www.joomla.org/
Vendor: Open Source Matters
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: Web
License: GPL/LGPL
Version: %{V_opkg}
Release: 20070626
# list of sources
Source0: http://downloads.joomlacode.org/frsrelease/1/0/1/10113/Joomla-%{V_dist}.tar.gz
Source1: joomla-setup.sh
Source2: joomla-apache.conf
Source3: rc.joomla
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20060823
PreReq: OpenPKG, openpkg >= 20060823
PreReq: apache
PreReq: apache-php
PreReq: apache-php::with_mysql = yes
PreReq: apache-php::with_zlib = yes
PreReq: apache-php::with_pcre = yes
PreReq: apache-php::with_xml = yes
PreReq: apache-php::with_gd = yes
PreReq: apache-php::with_mm = yes
PreReq: MTA
AutoReq: no
AutoReqProv: no
%description
Joomla! is a popular Web-based Content Management System (CMS).
%track
prog joomla = {
version = %{V_dist}
url = http://joomlacode.org/gf/project/joomla/frs/
regex = joomla-(__VER__)\.tar\.gz
}
%prep
%setup -q -c
%build
%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/joomla \
$RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime \
$RPM_BUILD_ROOT%{l_prefix}/var/joomla/db \
$RPM_BUILD_ROOT%{l_prefix}/var/joomla/log \
$RPM_BUILD_ROOT%{l_prefix}/var/joomla/run
# avoid trouble
mv "libraries/simplepie/compatibility_test/COMPATIBILITY README.txt" \
"libraries/simplepie/compatibility_test/COMPATIBILITY-README.txt"
# adjust default configuration
%{l_shtool} subst \
-e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;' \
installation/template/tmpl/configuration.html
# install main program files
find . -name ".#*" -print | xargs rm -f
find . -name "*.orig" -print | xargs rm -f
cp -rp * $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/configuration.php-dist
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/htaccess.txt
# post-adjustment: move risky installation area out of runtime area
# (will be dynmically linked in again later)
mv $RPM_BUILD_ROOT%{l_prefix}/lib/joomla/runtime/installation \
$RPM_BUILD_ROOT%{l_prefix}/lib/joomla/installation
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
-e 's;@l_path@;%{l_build_path};' \
%{SOURCE rc.joomla} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# install setup script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE joomla-setup.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/joomla-setup
# install 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 joomla-apache.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/joomla/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/joomla/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*/*/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/joomla/*/*/*/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/joomla' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/joomla/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
if [ $1 -eq 1 ]; then
# display final hints on initial installation
( echo "To complete the Joomla! installation:"
echo "1. start the MySQL RDBMS:"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc mysql start"
echo "2. setup the Joomla! database in the MySQL RDBMS:"
echo " \$ $RPM_INSTALL_PREFIX/sbin/joomla-setup install"
echo "3. start the Joomla! Apache webserver:"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc joomla start"
echo "4. setup Joomla! through the Web installer..."
echo " http://localhost:8080/joomla/"
echo " ..and on page \"4: Database\" use:"
echo " - Host Name: \"localhost\""
echo " - User Name: \"joomla\""
echo " - Password: \"joomla\""
echo " - Database Name: \"joomla\""
echo "5. fixup installation afterwards:"
echo " \$ $RPM_INSTALL_PREFIX/sbin/joomla-setup cleanup"
echo "6. access Joomla! via:"
echo " http://localhost:8080/joomla/ (website view)"
echo " http://localhost:8080/joomla/administrator (website admin)"
) | %{l_rpmtool} msg -b -t notice
elif [ $1 -eq 2 ]; then
# after upgrade, restart service
rm -f $RPM_INSTALL_PREFIX/lib/joomla/runtime/installation
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} joomla status 2>/dev/null`
[ ".$joomla_active" = .yes ] && %{l_rc} joomla restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# before erase, stop service
%{l_rc} joomla stop 2>/dev/null
# remove database
$RPM_INSTALL_PREFIX/sbin/joomla-setup uninstall >/dev/null 2>&1 || true
# remove run-time files
rm -f $RPM_INSTALL_PREFIX/var/joomla/db/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/joomla/db/*/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/joomla/run/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/joomla/log/* >/dev/null 2>&1 || true
fi
exit 0