##
## inn.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
## Copyright (c) 2000-2002 The OpenPKG Project
## Copyright (c) 2000-2002 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.
##
%define V_build stable
%define V_release 2.3.2
%define V_stable 20020203
# package information
Name: inn
Summary: InterNetNews Usenet Server
URL: http://www.isc.org/products/INN/
Vendor: Internet Software Consortium
Packager: The OpenPKG Project
Distribution: OpenPKG [REL]
Group: News
License: ISC
%if "%{V_build}" == "release"
Version: %{V_release}
%else
Version: %{V_release}.%{V_stable}
%endif
Release: 20020206
# list of sources
Source0: ftp://ftp.openpkg.org/DST/inn/fakesyslog.tar.gz
Source1: ftp://ftp.isc.org/isc/inn/inn-%{V_release}.tar.gz
Source2: ftp://ftp.isc.org/isc/inn/snapshots/inn-STABLE-%{V_stable}.tar.gz
Source3: rc.inn
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20020206, make, perl, db, openssl, bison, flex
PreReq: OpenPKG, openpkg >= 20020206, perl, MTA
AutoReq: no
AutoReqProv: no
%description
InterNetNews (INN) is a complete Usenet system. It includes innd, an
NNTP server, and nnrpd, a newsreading server. INN separates hosts
that feed you news from those that have users reading news.
%prep
%setup0 -q -c
%if "%{V_build}" == "release"
%setup1 -q -T -D -a 1
%else
%setup2 -q -T -D -a 2
%endif
%build
# make sure INN finds our own files
PATH="%{l_prefix}/bin:$PATH"
export PATH
# build faked syslog(3) library
fakesyslogdir="`pwd`/fakesyslog"
( cd fakesyslog
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
./configure \
--with-logfile=%{l_prefix}/var/inn/log/news.log
%{l_make} %{l_mflags}
)
%if "%{V_build}" == "release"
cd inn-%{V_release}
%else
cd inn-STABLE-%{V_stable}
%endif
# adjust some too strange INN paths
%{l_shtool} subst \
-e "s;^\\(PATHBIN.*=\\).*;\\1 \$(PATHNEWS)/libexec/inn;" \
Makefile.global.in
%{l_shtool} subst \
-e "s;^\\(pathbin:.*\\)@prefix@.*;\\1@prefix@/libexec/inn;" \
samples/inn.conf.in
# configure the source tree
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
LDFLAGS="-L$fakesyslogdir" \
LIBS="-lfakesyslog" \
./configure \
--prefix=%{l_prefix} \
--bindir=%{l_prefix}/libexec/inn \
--with-etc-dir=%{l_prefix}/etc/inn \
--with-db-dir=%{l_prefix}/var/inn/db \
--with-control-dir=%{l_prefix}/libexec/inn/control \
--with-filter-dir=%{l_prefix}/libexec/inn/filter \
--with-lib-dir=%{l_prefix}/lib/inn \
--with-log-dir=%{l_prefix}/var/inn/log \
--with-run-dir=%{l_prefix}/var/inn/run \
--with-spool-dir=%{l_prefix}/var/inn/spool \
--with-tmp-path=%{l_prefix}/var/inn/tmp \
--with-openssl=%{l_prefix} \
--with-berkeleydb=%{l_prefix} \
--with-news-user=%{l_musr} \
--with-news-group=%{l_musr} \
--with-news-master=%{l_musr} \
--with-sendmail=%{l_prefix}/sbin/sendmail \
--enable-uucp-rnews \
--with-perl
# build the INN system
%{l_make} %{l_mflags}
%install
rm -rf $RPM_BUILD_ROOT
%if "%{V_build}" == "release"
cd inn-%{V_release}
%else
cd inn-STABLE-%{V_stable}
%endif
# determine current user and group
thisuser=`(id -un) 2>/dev/null ||\
(whoami) 2>/dev/null ||\
(who am i | cut "-d " -f1) 2>/dev/null ||\
echo $LOGNAME`
thisgroup=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
grep "^${thisuser}:" | awk -F: '{ print $4; }' | head -1`
thisgroup=`(cat /etc/group; ypcat group) 2>/dev/null |\
grep ":${thisgroup}:" | awk -F: '{ print $1; }' | head -1`
if [ ".$thisgroup" = . ]; then
thisgroup="$thisuser"
fi
# adjust INN installation procedure
%{l_shtool} subst \
-e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
-e "s;^\\(PATH.*=[ ]*\\)\\(%{l_prefix}\\);\\1 $RPM_BUILD_ROOT\\2;" \
-e "s;^\\(NEWSUSER.*=\\).*;\\1 $thisuser;" \
-e "s;^\\(NEWSGROUP.*=\\).*;\\1 $thisgroup;" \
-e "s;^\\(OWNER.*=\\).*;\\1;" \
-e "s;^\\(ROWNER.*=\\).*;\\1;" \
Makefile.global
# perform installation procedure
%{l_make} %{l_mflags} install
# make some programs manually accessible
%{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin/
for bin in controlbatch controlchan news2mail startinnfeed overchan \
archive innmail innconfval ctlinnd inews rnews nntpsend; do
ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/$bin \
$RPM_BUILD_ROOT%{l_prefix}/bin/$bin
done
# strip installation
rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/*.py
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/*.tcl
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/lib*.a
rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_recover \
$RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
# adjust configuration
( echo ''
echo '# dummy entry to make INN happy as long as'
echo '# this server has no real newsfeeds configured.'
echo 'dummy-feed:!*::'
echo ''
) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/newsfeeds
( echo ''
echo '# use the traditional spool area for storage'
echo 'method tradspool {'
echo ' newsgroups: *'
echo ' class: 1'
echo '}'
) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/storage.conf
# create initial history database
( cd $RPM_BUILD_ROOT%{l_prefix}/var/inn/db
touch history
INNCONF=$RPM_BUILD_ROOT%{l_prefix}/etc/inn/inn.conf \
$RPM_BUILD_ROOT%{l_prefix}/libexec/inn/makedbz -i -f ./history
chmod 644 history*
)
# adjust permissions
chmod 664 $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/active
# create empty logfiles
touch $RPM_BUILD_ROOT%{l_prefix}/var/inn/log/news.log
# install run-command script
%{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 \
-e 's;@l_prefix@;%{l_prefix};g' \
-e 's;@l_musr@;%{l_musr};g' \
-e 's;@l_mgrp@;%{l_mgrp};g' \
%{SOURCE rc.inn} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# strip binaries
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
strip $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/* 2> /dev/null || true
# determine file list
%{l_rpmtool} files -v -o../files -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/inn/*' \
'%attr(4550,root,%{l_mgrp}) %{l_prefix}/bin/rnews' \
'%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/inndstart' \
'%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/startinnfeed' \
'%config %{l_prefix}/var/inn/db/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT