LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File inn.spec of Package inn (Project server:mail)

#
# spec file for package inn
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           inn
BuildRequires:  bison
BuildRequires:  gdbm-devel
BuildRequires:  gpg-offline
BuildRequires:  pam-devel
BuildRequires:  postfix
Url:            http://www.isc.org/software/inn/
Summary:        InterNetNews
License:        GPL-2.0+ and BSD-4-Clause
Group:          Productivity/Networking/News/Servers
Provides:       inn_pkg
Provides:       nntp_daemon
Conflicts:      cnews nntpd mininews
PreReq:         perl %fillup_prereq %insserv_prereq permissions
Requires:       perl-MIME-tools
Version:        2.5.2
Release:        0
%define PatchVersion -%{version}
Source:         inn%{PatchVersion}.tar.gz
Source1:        doc-inn.tar.bz2
Source2:        pubring.pgp
Source3:        inn-emptydb.tar.gz
Source4:        inn.reg
Source5:        inn%{PatchVersion}.tar.gz.asc
# Version 2.5.3 and above is signed with a new stronger key. Use "gpg-offline --package=inn --delete 0AFC7476" then.
Source6:        %{name}.keyring
Patch0:         inn-%{version}.diff
Patch1:         inn-linereset.diff
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#

%description
Rich Salz's InterNetNews news transport system.

%package devel
Requires:       %name = %version
Summary:        InterNetNews development files
Group:          Productivity/Networking/News/Servers

%description devel
Rich Salz's InterNetNews news transport system.

This package contains the files needed to develop software depending on
inn.

%package -n mininews
Summary:        Inews - Post News from an NNTP Client
Group:          Productivity/Networking/News/Utilities
Provides:       nntp_daemon
PreReq:         permissions

%description -n mininews
Rich Salz's InterNetNews news transport system.

%prep
%gpg_verify %{S:5}
%setup -n inn%{PatchVersion} 
%setup -n inn%{PatchVersion} -D -T -a 1 
%setup -n inn%{PatchVersion} -D -T -a 3
%patch0
%patch1
cp -a $RPM_SOURCE_DIR/pubring.pgp .

%build
LDFLAGS="-pie" CFLAGS="$RPM_OPT_FLAGS -pipe -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIE -fstack-protector" ./configure \
		--enable-dual-socket \
		--enable-uucp-rnews \
		--enable-setgid-inews \
		--prefix=/usr/lib/news \
		--sysconfdir=/etc/news \
		--mandir=%{_mandir} \
		--disable-shared \
		--enable-tagged-hash \
		--with-perl \
		--with-sendmail=/usr/sbin/sendmail \
		--with-news-user=news \
		--with-news-group=news \
		--with-news-master=news \
		--with-etc-dir=/etc/news \
		--with-db-dir=/var/lib/news \
		--with-run-dir=/var/run/news \
		--with-log-dir=/var/log/news \
		--with-http-dir=/var/log/news/http \
		--with-spool-dir=/var/spool/news \
		--with-tmp-dir=/var/spool/news/tmp
make

%install
mkdir -p %{buildroot}/etc
mkdir -p %{buildroot}/usr/lib
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/var/lib
mkdir -p %{buildroot}/var/log
mkdir -p %{buildroot}/var/spool
mkdir -p %{buildroot}%{_mandir}
#
make DESTDIR=%{buildroot} OWNER= ROWNER= install
rm %{buildroot}/usr/share/man/man8/actsyncd.8
gzip -nf9 %{buildroot}%{_mandir}/*/*
ln -s actsync.8.gz %{buildroot}/usr/share/man/man8/actsyncd.8.gz
chmod 444 %{buildroot}/usr/lib/news/lib/*.a
# those just die("BerkeleyDB support not compiled");
rm %{buildroot}/usr/lib/news/bin/ovdb_server
rm %{buildroot}/usr/lib/news/bin/ovdb_stat
ln %{buildroot}/usr/lib/news/bin/ovdb_init %{buildroot}/usr/lib/news/bin/ovdb_server
ln %{buildroot}/usr/lib/news/bin/ovdb_init %{buildroot}/usr/lib/news/bin/ovdb_stat
#
#
# 
%define installnews install -o news -g news -m
%define installnews install -m
%define installroot install -o root -g root -m
%define installroot install -m
%{installnews} 0755 	-d		%{buildroot}/var/log/news/http
%{installnews} 0644	subscriptions	%{buildroot}/etc/news
%{installnews} 0644	distributions	%{buildroot}/etc/news
%{installnews} 0644	crontab.sample	%{buildroot}/etc/news
%{installnews} 0644	profile		%{buildroot}/etc/news/.profile
%{installnews} 0755 	-d		%{buildroot}/etc/news/.pgp
%{installnews} 0600	pubring.pgp	%{buildroot}/etc/news/.pgp
%{installnews} 0644	samples/send-uucp.cf	%{buildroot}/etc/news
%{installnews} 0755 	-d		%{buildroot}/var/log/news/http
%{installnews} 0755 	-d		%{buildroot}/var/log/news/http/pics
%{installnews} 0555	convertspool	%{buildroot}/usr/lib/news/bin
%{installnews} 0755 	-d		%{buildroot}/usr/lib/news/include
%{installnews} 0755 	-d		%{buildroot}/usr/lib/news/include/inn
#%{installnews} 0644	include/clibrary.h	%{buildroot}/usr/lib/news/include
#%{installnews} 0644	include/config.h	%{buildroot}/usr/lib/news/include
#
# 
#
%{installnews} 0644	inn-emptydb/*	%{buildroot}/var/lib/news
%{installnews} 0755 	-d		%{buildroot}/var/lib/news/backoff
#
# compat links
#
ln -sf bin/inews		%{buildroot}/usr/lib/news/inews
ln -sf ../lib/news/bin/inews	%{buildroot}/usr/bin/inews
ln -sf ../lib/news/bin/rnews	%{buildroot}/usr/bin/rnews
#
# other links
#
ln -sf ../innfeed.status	%{buildroot}/var/log/news/http/innfeed.status.txt
ln -sf ../inn.status		%{buildroot}/var/log/news/http/inn.status.txt
#
# 
# 
mkdir -p 			%{buildroot}/etc/init.d
%{installnews} 0550	rc	%{buildroot}/etc/init.d/inn
mkdir -p 			%{buildroot}/usr/sbin
ln -sf ../../etc/init.d/inn 	%{buildroot}/usr/sbin/rcinn
#
touch				%{buildroot}/var/log/news/news
touch				%{buildroot}/var/log/news/news.notice
touch				%{buildroot}/var/log/news/news.err
touch				%{buildroot}/var/log/news/news.crit
touch				%{buildroot}/var/log/news/inn.status
touch				%{buildroot}/var/log/news/innfeed.status
#
# SLP regfile
#
%{installroot} 0755	-d		$RPM_BUILD_ROOT/etc/slp.reg.d
%{installroot} 0644	%{SOURCE4}	$RPM_BUILD_ROOT/etc/slp.reg.d/
# /var/run/news
mkdir -p $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/
echo "d /var/run/news 0750 news news -" > $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/inn.conf

#
# build filelist
# 
%define filelist %{name}-filelist
find %{buildroot} -type d -printf "/%%P\n" | awk '
! /^\/(etc|usr\/lib|var\/lib|var\/log|var\/spool|var\/run)\/news/ { next }
$0 == "/etc/news"     { next }
$0 == "/usr/lib/news" { next }
$0 == "/var/lib/news" { next }
$0 == "/usr/lib/news/include" { next }
$0 == "/usr/lib/news/include/inn" { next }
{ pfx="" }
$0 == "/var/spool/news" { pfx = "%%attr(775,news,news) " }
$0 == "/var/run/news" { pfx = "%ghost %%attr(750,news,news) "}
/\/news/ {
 	if (!match(pfx, /%%attr/)) pfx = "%%attr(-,news,news) " pfx
}
{ print "%dir " pfx $0 }
' > %{filelist}
find %{buildroot} ! -type d -printf "/%%P\n" | awk '
{ pfx="" }
/^\/usr\/lib\/news\/include/              { next }
/^\/usr\/lib\/news\/lib\/.*\.a/             { next }
$0 == "/etc/init.d/inn"                   { pfx="%attr(750,root,news) %config " }
$0 == "/usr/lib/news/bin/inews"           { pfx="%attr(2555,news,news) " }
$0 == "/usr/lib/news/bin/rnews"           { pfx="%attr(4550,news,uucp) " }
$0 == "/usr/lib/news/bin/innbind"         { pfx="%verify(not mode) %attr(4554,root,news) " }
/^\/(etc\/news|usr\/lib\/news\/bin\/filter|var\/lib\/news)\// {
	pfx="%config(noreplace) "pfx
}
/\/man\/man/ {
	pfx="%doc %attr(444,root,root) "pfx
}
/^\/var\/log\/news\/(news|inn\.status|innfeed\.status)/ {
	pfx="%ghost %attr(644,news,news) "pfx
}
/\/news\// {
 	if (!match(pfx, /%%attr/)) pfx = "%%attr(-,news,news) " pfx
}
/^\/etc\/slp\.reg\.d\// { next }
{ print pfx $0 }
' >> %{filelist}
#
# 
# 

%pre
test -f var/log/news && mv var/log/news var/log/news.bak
exit 0

%post
mkdir -p var/log/news
touch var/log/news/news.notice
touch var/log/news/news.err
touch var/log/news/news.crit
touch var/log/news/news
touch var/log/news/inn.status
touch var/log/news/innfeed.status
chown news:news var/log/news/news.notice var/log/news/news.err var/log/news/news.crit var/log/news/news var/log/news/inn.status var/log/news/innfeed.status
if test -e usr/lib/news/bin/control/version -o -e usr/lib/news/bin/inndstart ; then
    rm -f etc/news/inn.conf.OLD
    rm -f etc/news/newsfeeds.OLD
    usr/lib/news/bin/innupgrade etc/news
fi
if ! test -d /var/run/news ; then
    install -d -m 750 -o news -g news /var/run/news
fi
%{fillup_and_insserv inn}
%set_permissions /usr/lib/news/bin/innbind /usr/lib/news/bin/inews /usr/lib/news/bin/rnews

%post -n mininews
if [ -x /bin/systemd-tmpfiles ]; then
    /bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/inn.conf
fi
%set_permissions /usr/lib/news/bin/inews /usr/lib/news/bin/rnews

%verifyscript
%verify_permissions -e /usr/lib/news/bin/innbind -e /usr/lib/news/bin/inews -e /usr/lib/news/bin/rnews

%verifyscript -n mininews
%verify_permissions -e /usr/lib/news/bin/inews -e /usr/lib/news/bin/rnews

%preun
%stop_on_removal inn

%postun
%restart_on_update inn
%{insserv_cleanup}

%files -f %{filelist}
%defattr(-,root,root)
%dir			/etc/slp.reg.d
%config(noreplace)	/etc/slp.reg.d/inn.reg
%doc ChangeLog NEWS INSTALL README*
%doc doc-inn/*

%files devel
%defattr(-,root,root)
/usr/lib/news/include
/usr/lib/news/lib/*.a

%files -n mininews
%defattr(-,root,root)
%config(noreplace)      /etc/news/inn.conf
%dir %attr(-,news,news)	/usr/lib/news/bin
%attr(4550,news,uucp)   /usr/lib/news/bin/rnews
%attr(2555,news,news)   /usr/lib/news/bin/inews
                        /usr/bin/[ri]news
                        /usr/lib/news/[ri]news
%doc                    %{_mandir}/*/inn.conf.*
%doc                    %{_mandir}/*/[ri]news.*

%changelog