File tinyproxy.spec of Package tinyproxy

#
# spec file for package tinyproxy
#
# Copyright (c) 2013 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/
#


%if 0%{?suse_version} == 1110
%define _initddir /etc/init.d
%endif

Name:           tinyproxy
Summary:        Minimalist WWW proxy
License:        GPL-2.0+
Group:          Productivity/Networking/Web/Proxy
Version:        1.8.3
Release:        0
Url:            https://banu.com/tinyproxy/
Source:         https://banu.com/pub/tinyproxy/1.8/%{name}-%{version}.tar.bz2
Source1:        %{name}.logrotate
Source2:        %{name}.init
Patch1:         tinyproxy-conf.patch
Patch2:         110-seeding.diff
Patch3:         110-headerlimit.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# libxslt -> xsltproc
BuildRequires:  asciidoc
BuildRequires:  libxslt
Requires:       logrotate

%description
Tinyproxy is a light-weight HTTP/HTTPS proxy daemon for POSIX
operating systems. Designed from the ground up to be fast and yet
small, it is an ideal solution for use cases such as embedded
deployments where a full featured HTTP proxy is required, but the
system resources for a larger proxy are unavailable.

%prep
%setup -q
%patch -P 1 -P 2 -P 3 -p1

%build
%configure
make %{?_smp_mflags};

%install
make install DESTDIR=%{buildroot}

# add logrotate file
install -D -m0644 %{S:1} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}

# add init script + rc_link
install -D -m0755 %{S:2} %{buildroot}/%{_initddir}/%{name}
ln -sf %{_initddir}/%{name} %{buildroot}/%{_sbindir}/rc%{name}

# add logdir
install -d -m0750 %{buildroot}/var/log/%{name}

%pre
# add group
%{_sbindir}/groupadd -r %{name} 2>/dev/null || :
# add user
%{_sbindir}/useradd -c "Tinyproxy" -d /usr/share/%{name} -G %{name} -g %{name} \
  -r -s /bin/false %{name} 2>/dev/null || :
#if 0%{?has_systemd}
#service_add_pre tinyproxy.service
#endif

%post
%{fillup_and_insserv -n "tinyproxy"}

#if 0%{?has_systemd}
#service_add_post tinyproxy.service
#endif

%preun
%stop_on_removal tinyproxy

#if 0%{?has_systemd}
#service_del_preun tinyproxy.service
#endif

%postun
#if 0%{?has_systemd}
#service_del_postun tinyproxy.service
#endif

%restart_on_update tinyproxy
%insserv_cleanup
%stop_on_removal

%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/*.conf
%config %{_sysconfdir}/logrotate.d/%{name}
%attr(0755,root,root) %{_initddir}/%{name}
%{_sbindir}/*
%{_mandir}/man*/*
%{_datadir}/%{name}
%attr(750,%{name},root) /var/log/%{name}

%changelog
openSUSE Build Service is sponsored by