File wwwoffle.spec of Package wwwoffle

#
# spec file for package wwwoffle
#
# Copyright (c) 2017 SUSE LINUX 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:           wwwoffle
Version:        2.9j
Release:        0
Summary:        World Wide Web Offline Proxy
License:        GPL-2.0+
Group:          Productivity/Networking/Web/Proxy
Url:            http://www.gedanken.org.uk/software/wwwoffle/
Source0:        http://www.gedanken.org.uk/software/%{name}/download/%{name}-%{version}.tgz
Source1:        %{name}.service
Source3:        ip-up.%{name}
Source4:        ip-down.%{name}
Source5:        %{name}.cron
Patch0:         %{name}-2.8d-IndexProtocol.diff
Patch1:         %{name}-2.9e-implicit.patch
Patch2:         %{name}-2.9e-res_init.diff
Patch3:         %{name}-2.9i-fix-bashisms.patch
BuildRequires:  flex
BuildRequires:  htdig-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libgnutls-devel
BuildRequires:  systemd
BuildRequires:  zlib-devel
Requires:       cron
%{?systemd_requires}

%description
A proxy HTTP server for computers with dial-up internet access.

%prep
%setup -q
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
# easier to delete them now and include whole doc directory later
rm -f doc/README.win32 doc/*/README.win32

%build
export LC_ALL=C
%configure \
  --with-confdir=%{_sysconfdir}/%{name} \
  --with-gcrypt \
  --with-gnutls \
  --with-ipv6 \
  --with-zlib
make %{?_smp_mflags}

%install
export LC_ALL=C
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}/%{_sysconfdir}/cron.{daily,weekly}
%make_install
install -m 755 %{SOURCE3} $RPM_BUILD_DIR
sed "s@%{_sysconfdir}/wwwoffle\\.conf@%{_sysconfdir}/wwwoffle/wwwoffle.conf@g" < doc/wwwoffled.man \
	> %{buildroot}%{_mandir}/man8/wwwoffled.8
install -D -m 0644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}.service
ln -sf service %{buildroot}/%{_sbindir}/rc%{name}
install -d -m 755 %{buildroot}%{_localstatedir}/adm/fillup-templates
install -d -m 755 %{buildroot}%{_sysconfdir}/ppp/ip-{up,down}.d
install -m 755 %{SOURCE3} %{buildroot}/%{_sysconfdir}/ppp/ip-up.d/%{name}
install -m 755 %{SOURCE4} %{buildroot}/%{_sysconfdir}/ppp/ip-down.d/%{name}
install -m 644 %{SOURCE5} %{buildroot}/%{_sysconfdir}/cron.weekly/%{name}
# run as wwwrun:www by default
pushd %{buildroot}%{_sysconfdir}/%{name}
sed "s/^#run-uid.*/ run-uid           = wwwrun/
     s/^#run-gid.*/ run-gid           = www/" < %{name}.conf > %{name}.conf.t
mv %{name}.conf.t %{name}.conf
popd
rm -rf %{buildroot}%{_prefix}/doc/%{name}
rm -rf %{buildroot}%{_localstatedir}/spool/%{name}/outgoing/*
rm -f doc/ANNOUNCE~

%pre
%service_add_pre %{name}.service

%preun
%service_del_preun %{name}.service

%post
%service_add_post %{name}.service

%postun
%service_del_postun %{name}.service

%files
%defattr(-, root, root)
# docs
%doc ChangeLog* contrib doc/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*
# wwwoffle configs
%{_unitdir}/%{name}.service
%config(missingok,noreplace) %attr(755,root,root) %{_sysconfdir}/cron.weekly/%{name}
%dir %attr(750, wwwrun, root) %{_sysconfdir}/%{name}
%config %attr(640, wwwrun, root) %{_sysconfdir}/%{name}/%{name}.conf
%dir %{_localstatedir}/spool/%{name}/search/
# search configs for htdig
%dir %{_localstatedir}/spool/%{name}/search/htdig
%dir %{_localstatedir}/spool/%{name}/search/htdig/conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/htdig/conf/htfuzzy.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/htdig/conf/htsearch.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/htdig/conf/htdig-full.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/htdig/conf/htdig-lasttime.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/htdig/conf/htdig-incr.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/htdig/conf/htmerge.conf
# search configs for mnogosearch
%dir %{_localstatedir}/spool/%{name}/search/mnogosearch
%dir %{_localstatedir}/spool/%{name}/search/mnogosearch/conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/mnogosearch/conf/indexer-full.old.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/mnogosearch/conf/result.html
%config(noreplace) %{_localstatedir}/spool/%{name}/search/mnogosearch/conf/indexer-incr.old.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/mnogosearch/conf/indexer-full.conf
%config(noreplace) %{_localstatedir}/spool/%{name}/search/mnogosearch/conf/indexer-incr.conf
# search configs for namazu
%dir %{_localstatedir}/spool/%{name}/search/namazu
%dir %{_localstatedir}/spool/%{name}/search/namazu/conf/
%config(noreplace) %{_localstatedir}/spool/%{name}/search/namazu/conf/mknmzrc
%config(noreplace) %{_localstatedir}/spool/%{name}/search/namazu/conf/namazurc
%dir %attr(750, wwwrun, root) %{_localstatedir}/spool/%{name}
%dir %{_localstatedir}/spool/%{name}/html
%doc %{_localstatedir}/spool/%{name}/html/*
%dir %attr(-, wwwrun, root) %{_localstatedir}/spool/%{name}/http
%dir %attr(-, wwwrun, root) %{_localstatedir}/spool/%{name}/lasttime
%dir %attr(-, wwwrun, root) %{_localstatedir}/spool/%{name}/monitor
%dir %attr(-, wwwrun, root) %{_localstatedir}/spool/%{name}/outgoing
%dir %attr(-, wwwrun, root) %{_localstatedir}/spool/%{name}/prevtime1
# rest of htdig
%{_localstatedir}/spool/%{name}/search/htdig/db
%{_localstatedir}/spool/%{name}/search/htdig/tmp
%{_localstatedir}/spool/%{name}/search/htdig/scripts
%{_localstatedir}/spool/%{name}/search/htdig/db-lasttime
# rest of mnogosearch
%{_localstatedir}/spool/%{name}/search/mnogosearch/db
%{_localstatedir}/spool/%{name}/search/mnogosearch/scripts
%{_localstatedir}/spool/%{name}/search/udmsearch
# rest of namazu
%{_localstatedir}/spool/%{name}/search/namazu/db
%{_localstatedir}/spool/%{name}/search/namazu/scripts
# hyperestraier
%{_localstatedir}/spool/%{name}/search/hyperestraier
%config(noreplace) %{_localstatedir}/spool/%{name}/search/hyperestraier/conf/estseek.conf
%{_bindir}/*
%{_sbindir}/*
%{_sysconfdir}/ppp/ip-up.d/%{name}
%{_sysconfdir}/ppp/ip-down.d/%{name}

%changelog
openSUSE Build Service is sponsored by