You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
275 lines
11 KiB
275 lines
11 KiB
## |
|
## inn.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## 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: inn |
|
Summary: InterNetNews Usenet Server |
|
URL: http://www.isc.org/products/INN/ |
|
Vendor: Internet Software Consortium |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: BASE |
|
Group: News |
|
License: ISC |
|
Version: 2.4.6 |
|
Release: 20090309 |
|
|
|
# package options |
|
%option with_fsl yes |
|
|
|
# list of sources |
|
Source0: ftp://ftp.isc.org/isc/inn/inn-%{version}.tar.gz |
|
Source1: rc.inn |
|
Source2: fsl.inn |
|
Patch0: inn.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101, gcc, gzip, make, perl, bison, flex |
|
PreReq: OpenPKG, openpkg >= 20160101, gcc, gzip, perl, MTA |
|
BuildPreReq: db >= 4.3, openssl |
|
PreReq: db >= 4.3, openssl |
|
%if "%{with_fsl}" == "yes" |
|
BuildPreReq: fsl |
|
PreReq: fsl |
|
%endif |
|
|
|
%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. |
|
|
|
%track |
|
prog inn = { |
|
version = %{version} |
|
url = ftp://ftp.isc.org/isc/inn/ |
|
regex = inn-(__VER__)\.tar\.gz |
|
} |
|
|
|
%prep |
|
%setup -q |
|
%patch -p0 |
|
|
|
%build |
|
# 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;" \ |
|
-e "s;^#bindaddress:.*;bindaddress: 127.0.0.1;" \ |
|
-e "s;^#sourceaddress:.*;sourceaddress: 127.0.0.1;" \ |
|
samples/inn.conf.in |
|
%{l_shtool} subst \ |
|
-e 's;\(ExtUtils::Embed.*ldopts.*tail -1\);\1 | sed -e "s/ -lc\\$/ /" -e "s/ -lc / /";' \ |
|
configure |
|
|
|
# correctly specify missing realtime functions library |
|
LIBS="%{l_fsl_libs}" |
|
case "%{l_platform -t}" in |
|
*-sunos* ) LIBS="$LIBS -lrt -lresolv -lnsl" ;; |
|
esac |
|
|
|
# configure the source tree |
|
CC="%{l_cc}" \ |
|
CFLAGS="%{l_cflags -O} %{l_cppflags}" \ |
|
LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ |
|
LIBS="$LIBS" \ |
|
./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-dir=%{l_prefix}/var/inn/tmp \ |
|
--with-openssl=%{l_prefix} \ |
|
--with-berkeleydb=%{l_prefix} \ |
|
--with-news-user=%{l_rusr} \ |
|
--with-news-group=%{l_rgrp} \ |
|
--with-news-master=%{l_rusr} \ |
|
--with-sendmail=%{l_prefix}/sbin/sendmail \ |
|
--enable-uucp-rnews \ |
|
--with-perl |
|
|
|
# build the INN system |
|
%{l_make} %{l_mflags} |
|
|
|
%install |
|
|
|
# determine current user and group |
|
thisuser=`%{l_shtool} echo -e '%u'` |
|
thisgroup=`%{l_shtool} echo -e '%g'` |
|
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 -rf $RPM_BUILD_ROOT%{l_prefix}/doc |
|
rm -rf $RPM_BUILD_ROOT%{l_prefix}/include |
|
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 |
|
touch $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/history |
|
|
|
# adjust permissions |
|
chmod 664 $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/active |
|
|
|
# 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 %{l_value -s -a} \ |
|
%{SOURCE rc.inn} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
|
|
# install OSSP fsl configuration |
|
%{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE fsl.inn} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
|
|
|
# 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 |
|
|
|
# create temporary directory |
|
%{l_shtool} mkdir -f -p -m 770 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/inn/tmp |
|
|
|
# move default db to template space |
|
%{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/db |
|
mv $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/* \ |
|
$RPM_BUILD_ROOT%{l_prefix}/libexec/inn/db/ |
|
|
|
# determine file list |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
%{l_files_std} \ |
|
'%config %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/fsl/fsl.inn' \ |
|
'%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/inn/*' \ |
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/inn/innreport_inn.pm' \ |
|
'%attr(6550,%{l_rusr},%{l_rgrp}) %{l_prefix}/libexec/inn/rnews' \ |
|
'%attr(6750,%{l_susr},%{l_rgrp}) %{l_prefix}/libexec/inn/inndstart' \ |
|
'%attr(6750,%{l_susr},%{l_rgrp}) %{l_prefix}/libexec/inn/startinnfeed' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/cnfsheadconf' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/ctlinnd' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/expire' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/expireover' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/expirerm' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/imapfeed' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/inews' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/inncheck' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innd' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innfeed' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innreport' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innstat' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innupgrade' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/innwatch' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/makedbz' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/makehistory' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/mod-active' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/news.daily' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/ovdb_*' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/overchan' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/procbatch' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/prunehistory' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/rc.news' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/scanlogs' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/tally.control' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/tdx-util' \ |
|
'%attr(750,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/inn/writelog' \ |
|
'%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/db' \ |
|
'%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/log' \ |
|
'%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/run' \ |
|
'%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/spool' \ |
|
'%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/spool/*' \ |
|
'%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/inn/tmp' |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
%post |
|
# after install, create db as restricted user |
|
if [ $1 -eq 1 ]; then |
|
for f in active active.times history newsgroups; do |
|
%{l_shtool} install -c -m 644 -o %{l_rusr} -g %{l_rgrp} \ |
|
$RPM_INSTALL_PREFIX/libexec/inn/db/$f \ |
|
$RPM_INSTALL_PREFIX/var/inn/db/ |
|
done |
|
su - %{l_rusr} -c "$RPM_INSTALL_PREFIX/libexec/inn/makedbz -i -o" |
|
fi |
|
|
|
# after upgrade, restart service |
|
[ $1 -eq 2 ] || exit 0 |
|
eval `%{l_rc} inn status 2>/dev/null` |
|
[ ".$inn_active" = .yes ] && %{l_rc} inn restart |
|
exit 0 |
|
|
|
%preun |
|
# before erase, stop service and remove log files |
|
[ $1 -eq 0 ] || exit 0 |
|
%{l_rc} inn stop 2>/dev/null |
|
rm -rf $RPM_INSTALL_PREFIX/var/inn/log/* >/dev/null 2>&1 || true |
|
exit 0 |
|
|
|
|