File dropbear.spec of Package dropbear

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


%if 0%{?suse_version} >= 1230
  %define using_systemd 1
%endif

Name:           dropbear
Version:        2015.68
Release:        0
Summary:        A relatively small SSH 2 server and client
License:        MIT
Group:          Productivity/Networking/SSH
Url:            http://matt.ucc.asn.au/dropbear/dropbear.html
Source0:        https://matt.ucc.asn.au/dropbear/%{name}-%{version}.tar.bz2
Source1:        https://matt.ucc.asn.au/dropbear/%{name}-%{version}.tar.bz2.asc
Source3:        dropbear.service
Source4:        dropbear-keygen.service
Source5:        dropbear.sysconfig
Source6:        dropbear.init
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  zlib-devel
%if 0%{?using_systemd}
%{?systemd_requires}
%else
Requires(pre): %insserv_prereq
%endif
Requires(pre):	%fillup_prereq

%description
Dropbear is a SSH 2 server and client designed to be small enough to be used in small memory environments, while still being functional and secure enough for general use.

It implements most required features of the SSH 2 protocol, and other features such as X11 and authentication agent forwarding.

%prep
%setup -q

%build
%configure
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}
install -d %{buildroot}%{_sysconfdir}/%{name}
install -D -m 0644 %{SOURCE5} "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}"
%if 0%{?using_systemd}
  install -d %{buildroot}%{_unitdir}
  install -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
  install -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/%{name}-keygen.service
  ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
  ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}-keygen
%else
  install -D -m0755 %{SOURCE6} "%{buildroot}%{_initrddir}/%{name}"
  ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}"
%endif

%pre
%if 0%{?using_systemd}
  %service_add_pre %{name}.service
  %service_add_pre %{name}-keygen.service
%endif

%post
%if 0%{?using_systemd}
  %fillup_only
  %service_add_post %{name}.service
  %service_add_post %{name}-keygen.service
%else
  %{fillup_and_insserv %{name}}
%endif

%preun
%if 0%{?using_systemd}
  %service_del_preun %{name}.service
  %service_del_preun %{name}-keygen.service
%else
  %stop_on_removal %{name}
%endif

%postun
%if 0%{?using_systemd}
  %service_del_postun %{name}.service
  %service_del_postun %{name}-keygen.service
%else
  %restart_on_update %{name}
  %insserv_cleanup
%endif

%files
%defattr(-,root,root)
%{_bindir}/dbclient
%{_bindir}/dropbearconvert
%{_bindir}/dropbearkey
%{_sbindir}/dropbear
%{_sbindir}/rcdropbear
%if 0%{?using_systemd}
  %{_unitdir}/%{name}.service
  %{_unitdir}/dropbear-keygen.service
  %{_sbindir}/rcdropbear-keygen
%else
  %{_initrddir}/%{name}
%endif
%dir %{_sysconfdir}/%{name}
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%{_mandir}/man8/dropbear.8.gz
%{_mandir}/man1/dbclient.1.gz
%{_mandir}/man1/dropbearkey.1.gz
%{_mandir}/man1/dropbearconvert.1.gz

%changelog
openSUSE Build Service is sponsored by