File dropbear.spec of Package dropbear
#
# spec file for package dropbear
#
# 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: dropbear
Version: 2012.55
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: http://matt.ucc.asn.au/dropbear/releases/%{name}-%{version}.tar.bz2
Source1: dropbear.service
Source2: dropbear-keygen.service
Source3: dropbear.sysconfig
Source4: rcdropbear
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: zlib-devel
Requires(post): %fillup_prereq %insserv_prereq
%if 0%{?suse_version} >= 1210
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%endif
%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 %{SOURCE3} "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}"
install -D -m0755 %{SOURCE4} "%{buildroot}%{_initrddir}/%{name}"
ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}"
%if 0%{?suse_version} >= 1210
# systemd unit files
install -d %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
install -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/dropbear-keygen.service
%endif
install -d "%{buildroot}%{_mandir}/man1/"
install -m644 dbclient.1 "%{buildroot}%{_mandir}/man1/"
install -d "%{buildroot}%{_mandir}/man8/"
install -m644 dropbear.8 "%{buildroot}%{_mandir}/man8/"
install -m644 dropbearkey.8 "%{buildroot}%{_mandir}/man8/"
%post
%if 0%{?suse_version} >= 1210
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%endif
%{fillup_and_insserv %{name}}
%preun
%if 0%{?suse_version} >= 1210
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
/bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
fi
%endif
%stop_on_removal %{name}
%postun
%if 0%{?suse_version} >= 1210
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi
%endif
%restart_on_update %{name}
%insserv_cleanup
%files
%defattr(-,root,root)
%{_bindir}/dbclient
%{_bindir}/dropbearconvert
%{_bindir}/dropbearkey
%{_sbindir}/dropbear
%{_sbindir}/rcdropbear
%{_initrddir}/%{name}
%if 0%{?suse_version} >= 1210
%{_unitdir}/%{name}.service
%{_unitdir}/dropbear-keygen.service
%endif
%dir %{_sysconfdir}/%{name}
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
%{_mandir}/man1/dbclient.1.gz
%{_mandir}/man8/dropbear.8.gz
%{_mandir}/man8/dropbearkey.8.gz
%changelog