##
## twiki.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2004 The OpenPKG Project
## Copyright (c) 2000-2004 Ralf S. Engelschall
## Copyright (c) 2000-2004 Cable & Wireless
##
## 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: twiki
Summary: Wiki Wiki based Collaboration Platform
URL: http://twiki.org/
Vendor: Peter Thoeny
Packager: The OpenPKG Project
Distribution: OpenPKG
Class: EVAL
Group: Web
License: GPL
Version: 20041030
Release: 20041107
# list of sources
Source0: http://TWikiGuest:guest@twiki.org/release/TWiki%{version}beta.zip
Source1: twiki-apache.conf
Source2: rc.twiki
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, infozip, perl
PreReq: OpenPKG, openpkg >= 20040130
PreReq: perl, perl-net, perl-mail, perl-crypto
PreReq: rcs, diffutils, grep
PreReq: apache, MTA
AutoReq: no
AutoReqProv: no
%description
TWiki s a flexible, powerful, and easy to use Web-based
collaboration platform based on the popular Wiki Wiki principle.
%track
prog twiki = {
version = %{version}
url = http://TWikiGuest:guest@twiki.org/cgi-bin/view/Codev/TWikiBetaRelease
regex = TWiki(__VER__)beta\.zip
}
%prep
%setup -q -c -T
%{l_prefix}/bin/unzip -x -q %{SOURCE0}
%build
%install
# create installation area
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/twiki \
$RPM_BUILD_ROOT%{l_prefix}/lib/twiki \
$RPM_BUILD_ROOT%{l_prefix}/libexec/twiki \
$RPM_BUILD_ROOT%{l_prefix}/var/twiki
# install TWiki CGIs
# (set path to custom Perl and library path)
%{l_shtool} install -c -m 755 \
-e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
-e "s;'../lib';'%{l_prefix}/lib/twiki';g" \
bin/* $RPM_BUILD_ROOT%{l_prefix}/libexec/twiki/
# install TWiki library and configuration
# (move primary configuration file to canonical location and pre-configure)
%{l_shtool} install -c -m 644 \
-e 's;http://your.domain.com;http://localhost;g' \
-e 's;/home/httpd/twiki/pub;%{l_prefix}/var/twiki/pub;g' \
-e 's;/home/httpd/twiki/templates;%{l_prefix}/etc/twiki/tmpl;g' \
-e 's;/home/httpd/twiki/data;%{l_prefix}/var/twiki/data;g' \
-e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
-e "s;'/usr/bin';'%{l_prefix}/bin';g" \
-e 's;/bin/egrep;%{l_prefix}/bin/egrep;g' \
-e 's;/bin/fgrep;%{l_prefix}/bin/fgrep;g' \
lib/TWiki.cfg \
$RPM_BUILD_ROOT%{l_prefix}/etc/twiki/twiki.conf
rm -f lib/TWiki.cfg
( cd lib && %{l_tar} cf - . ) | \
( cd $RPM_BUILD_ROOT%{l_prefix}/lib/twiki && %{l_tar} xf - ) || exit $?
ln $RPM_BUILD_ROOT%{l_prefix}/etc/twiki/twiki.conf \
$RPM_BUILD_ROOT%{l_prefix}/lib/twiki/TWiki.cfg
# install TWiki initial data
# (adjust RCS content for Apache run-time environment)
%{l_prefix}/bin/perl \
-pi.orig -e 'NR <= 10 && s/nobody:/%{l_nusr}:/' \
data/*/*,v
find data -type f -name "*.orig" -print | xargs rm -f
find data -type f -print | xargs chmod 664
find data -type d -print | xargs chmod 775
%{l_tar} cf - data | \
( cd $RPM_BUILD_ROOT%{l_prefix}/var/twiki && %{l_tar} xf - ) || exit $?
# install TWiki public files
find pub -type f -print | xargs chmod 664
find pub -type d -print | xargs chmod 775
%{l_tar} cf - pub | \
( cd $RPM_BUILD_ROOT%{l_prefix}/var/twiki && %{l_tar} xf - ) || exit $?
# install TWiki template files
mv templates tmpl
find tmpl -type f -print | xargs chmod 664
find tmpl -type d -print | xargs chmod 775
%{l_tar} cf - tmpl | \
( cd $RPM_BUILD_ROOT%{l_prefix}/etc/twiki && %{l_tar} xf - ) || exit $?
# install Apache configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE twiki-apache.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/twiki/
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.twiki} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/twiki/twiki*' \
'%config %{l_prefix}/etc/twiki/templates/*' \
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/twiki'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
if [ ".$1" = .1 ]; then
# add hook to Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
( echo "Include $RPM_INSTALL_PREFIX/etc/twiki/twiki-apache.conf"
) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:twiki" $apacheconf
fi
# display information about steps the admin should perform next
( echo "TWiki was successfully installed. You should now start Apache with"
echo " \$ $RPM_INSTALL_PREFIX/etc/rc apache start"
echo "and then edit the TWiki site-level preferences under:"
echo " http://localhost/twiki/bin/view/TWiki/TWikiPreferences"
) | %{l_rpmtool} msg -b -t notice
fi
%postun
if [ ".$1" = .0 ]; then
# remove hook from Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:twiki" $apacheconf
fi
fi