##
## gup.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
## Copyright (c) 2000-2001 The OpenPKG Project
## Copyright (c) 2000-2001 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: gup
Summary: Group Update (Newsgroups Subscription Manager)
URL: http://packages.debian.org/stable/news/gup.html
Vendor: Mark Delany
Packager: The OpenPKG Project
Distribution: OpenPKG [REL]
Group: Converter
License: Public Domain
Version: 0.5.7
Release: 20011201.0
# list of sources
Source0: ftp://ftp.debian.org/debian/pool/main/g/gup/gup_%{version}.tar.gz
Patch0: gup-%{version}.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20011126.0
PreReq: OpenPKG, openpkg >= 20011126.0, MTA, inn
AutoReq: no
AutoReqProv: no
%description
%prep
%setup -q -n gup-%{version}
%patch -p0
%build
%{l_rpmtool} subst \
's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;' \
's;/var/lib/news;%{l_prefix}/var/gup;' \
's;"news";"postmaster";' \
's;USE_FLOCK;USE_DOTLOCK;' \
-- config.h
%{l_make} %{l_mflags -O} \
CC="%{l_cc}" \
P_CFLAGS="%{l_cflags -O}"
%install
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/man/man8 \
$RPM_BUILD_ROOT%{l_prefix}/etc/gup \
$RPM_BUILD_ROOT%{l_prefix}/var/gup/sites
%{l_shtool} install -c -s -m 4755 \
gup $RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 644 \
gup.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
echo "test test postmaster@localhost" >config
%{l_shtool} install -c -m 600 \
config $RPM_BUILD_ROOT%{l_prefix}/etc/gup/config
( echo "From: \"Group Update\" "
echo "User-Agent: gup/%{version}"
echo ""
echo "This is the Group Update (gup/%{version}) service on"
echo "localhost managing your Usenet newsgroup subscription."
) >header
%{l_shtool} install -c -m 644 \
header $RPM_BUILD_ROOT%{l_prefix}/etc/gup/header
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
aliases_file=`$RPM_INSTALL_PREFIX/etc/rc --query mta_aliases_file`
update_command=`$RPM_INSTALL_PREFIX/etc/rc --query mta_aliases_update`
if [ ".$aliases_file" != . ]; then
gup="$RPM_INSTALL_PREFIX/sbin/gup"
gup="$gup -d $RPM_INSTALL_PREFIX/etc/gup"
gup="$gup -m $RPM_INSTALL_PREFIX/etc/gup/header"
gup="$gup -s $RPM_INSTALL_PREFIX/var/gup/sites"
gup="$gup -l $RPM_INSTALL_PREFIX/var/gup/logfile"
gup="$gup -a $RPM_INSTALL_PREFIX/var/inn/db/active"
gup="$gup -n $RPM_INSTALL_PREFIX/var/inn/db/newsgroups"
echo "gup: \"|$gup\"" |\
$RPM_INSTALL_PREFIX/sbin/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:gup" $aliases_file
fi
if [ ".$update_command" != . ]; then
eval $update_command
fi
%preun
aliases_file=`$RPM_INSTALL_PREFIX/etc/rc --query mta_aliases_file`
update_command=`$RPM_INSTALL_PREFIX/etc/rc --query mta_aliases_update`
if [ ".$aliases_file" != . ]; then
$RPM_INSTALL_PREFIX/sbin/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:gup" $aliases_file
fi
if [ ".$update_command" != . ]; then
eval $update_command
fi