File dropbear.spec of Package dropbear.openSUSE_13.1_Update

#
# spec file for package dropbear
#
# 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:           dropbear
Version:        2013.60
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:        https://matt.ucc.asn.au/dropbear/SHA1SUM.asc
Source2:        dropbear.keyring
Source3:        dropbear.service
Source4:        dropbear-keygen.service
Source5:        dropbear.sysconfig
Source6:        rcdropbear
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  zlib-devel
%if 0%{?suse_version} >= 1230
BuildRequires:  gpg-offline
%endif
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
%{?gpg_verify: %gpg_verify %{SOURCE1}}
%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}"
#no init service needed anymore for 12.3+
install -D -m0755 %{SOURCE6} "%{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 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
	install -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/dropbear-keygen.service
%endif

%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}/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