stunnel/stunnel.spec

182 lines
5.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package stunnel
#
# 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/
#
Name: stunnel
Version: 5.39
Release: 0
Summary: Universal SSL Tunnel
License: GPL-2.0+
Group: Productivity/Networking/Security
Url: http://www.stunnel.org/
PreReq: /usr/sbin/useradd fileutils textutils %insserv_prereq %fillup_prereq
Source: ftp://ftp.stunnel.org/stunnel/%{name}-%{version}.tar.gz
Source1: stunnel.conf
Source2: stunnel.README
Source3: sysconfig.syslog-stunnel
Source4: stunnel.rc
Source5: stunnel.service
Patch0: stunnel-listenqueue-option.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define VENDOR openSUSE
BuildRequires: tcpd-devel zlib-devel
BuildRequires: libopenssl-devel
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%endif
%description
The stunnel program is designed to work as an SSL encryption wrapper
between remote clients and local (inetd-startable) or remote
servers. The concept is that, while having non-SSL aware daemons running on
your system, you can set them to communicate with clients over a
secure SSL channels. Stunnel can be used to add SSL functionality to
commonly used inetd daemons, such as POP-2, POP-3, and IMAP servers
without any changes to the program code.
%package doc
Summary: Documentation for the universal SSL Tunnel
Group: Documentation/Other
Requires: stunnel = %{version}
%if 0%{?suse_version} >= 1210
BuildArch: noarch
%endif
%description doc
This package contains additional documentation for the stunnel program.
%prep
%setup -q -n stunnel-%{version}
%patch0 -p0
chmod -x $RPM_BUILD_DIR/stunnel-%{version}/tools/ca.*
chmod -x $RPM_BUILD_DIR/stunnel-%{version}/tools/importCA.*
%build
sed -i 's/-m 1770 -g nogroup//g' tools/Makefile.in
%if 0%{?suse_version} == 1110
%configure --disable-static --disable-fips --bindir=%{_sbindir}
%else
%configure --disable-static --bindir=%{_sbindir}
%endif
make %{?_smp_mflags} LDADD="-pie -Wl,-z,defs,-z,relro"
%install
make install DESTDIR=$RPM_BUILD_ROOT
cp -p %{S:1} tools/stunnel.conf-sample.%VENDOR
cp -p %{S:2} README.%VENDOR
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
cp -p %{S:3} $RPM_BUILD_ROOT/var/adm/fillup-templates/
%if 0%{?has_systemd}
install -D -m 0644 $RPM_SOURCE_DIR/stunnel.service $RPM_BUILD_ROOT/%_unitdir/stunnel.service
ln -s service $RPM_BUILD_ROOT/usr/sbin/rcstunnel
%else
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
install -m 744 $RPM_SOURCE_DIR/stunnel.rc $RPM_BUILD_ROOT/etc/init.d/stunnel
ln -s ../../etc/init.d/stunnel $RPM_BUILD_ROOT/usr/sbin/rcstunnel
%endif
mv $RPM_BUILD_ROOT/%{_sysconfdir}/stunnel/stunnel.conf-sample tools/stunnel.conf-sample
rm $RPM_BUILD_ROOT/%{_libdir}/stunnel/*.la
rm -rf $RPM_BUILD_ROOT/usr/share/doc/packages/stunnel/INSTALL
rm -rf $RPM_BUILD_ROOT/usr/share/doc/packages/stunnel/INSTALL.WCE
rm -rf $RPM_BUILD_ROOT/usr/share/doc/packages/stunnel/INSTALL.W32
rm -rf $RPM_BUILD_ROOT/usr/share/doc/packages/stunnel/tools/stunnel.cnf
rm -rf $RPM_BUILD_ROOT/usr/share/doc/stunnel
mkdir -p $RPM_BUILD_ROOT/var/lib/stunnel/{bin,etc,dev,%_lib,sbin,var/run}
%pre
if ! /usr/bin/getent passwd stunnel >/dev/null; then
%{_sbindir}/useradd -r -c "Daemon user for stunnel (universal SSL tunnel)" -g nogroup -s /bin/false \
-d /var/lib/stunnel stunnel || :
fi
%if 0%{?has_systemd}
%service_add_pre %{name}.service
%endif
%post
%if 0%{?has_systemd}
%service_add_post %{name}.service
%else
%{fillup_and_insserv -f}
%endif
%{fillup_only -ans syslog stunnel}
if ! test -s etc/stunnel/stunnel.conf; then
cp -p usr/share/doc/packages/stunnel/stunnel.conf-sample etc/stunnel/stunnel.conf
echo copying default config file to /etc/stunnel/stunnel.conf
fi
# first installation?
if [ ${FIRST_ARG:-0} = 1 ]; then
if ! test -f etc/stunnel/stunnel.pem; then
cat usr/share/doc/packages/stunnel/README.%VENDOR
fi
fi
%preun
%if 0%{?has_systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal stunnel
%endif
%postun
%if 0%{?has_systemd}
%service_del_postun %{name}.service
%else
%restart_on_update stunnel
%insserv_cleanup
%endif
%files
%defattr(-, root, root)
%doc COPYING COPYRIGHT.GPL CREDITS
%doc README.%VENDOR
%doc tools/ca.*
%doc tools/importCA.*
%doc tools/stunnel.conf-sample
%{_sbindir}/*
%{_libdir}/stunnel
%{_mandir}/man8/*
%dir %attr(700,root,root) %{_sysconfdir}/stunnel
%dir %attr(755,root,root) /var/lib/stunnel
%dir %attr(755,root,root) /var/lib/stunnel/bin
%dir %attr(755,root,root) /var/lib/stunnel/etc
%dir %attr(755,root,root) /var/lib/stunnel/dev
%dir %attr(755,root,root) /var/lib/stunnel/%_lib
%dir %attr(755,root,root) /var/lib/stunnel/sbin
%dir %attr(755,root,root) /var/lib/stunnel/var
%dir %attr(755,stunnel,root) /var/lib/stunnel/var/run
/var/adm/fillup-templates/sysconfig.syslog-stunnel
%if 0%{?has_systemd}
%_unitdir/stunnel.service
%else
%config /etc/init.d/*
%endif
%files doc
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING COPYRIGHT.GPL CREDITS ChangeLog NEWS PORTS
%doc README TODO
%doc doc/stunnel.html
%doc doc/stunnel.*.html
%doc doc/en/*
%doc doc/pl