# # spec file for package autossh # # Copyright (c) 2018 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 https://bugs.opensuse.org/ # #Compat macro for new _fillupdir macro introduced in Nov 2017 %if ! %{defined _fillupdir} %define _fillupdir /var/adm/fillup-templates %endif %if 0%{?suse_version} > 1220 %define with_systemd 1 %else %define with_systemd 0 %endif Summary: Automatically restart SSH sessions and tunnels License: BSD-3-Clause Group: Productivity/Networking/SSH Name: autossh Version: 1.4f Release: 0 Url: http://www.harding.motd.ca/autossh/ Source: http://www.harding.motd.ca/autossh/%{name}-%{version}.tgz Source1: autossh.init Source2: autossh.conf Source3: autossh.service Source4: my.conf Source5: README.SUSE.md BuildRoot: %{_tmppath}/%{name}-%{version}-build # configure checks is the ssh client exists BuildRequires: openssh Requires: openssh %if %{with_systemd} BuildRequires: systemd %{?systemd_requires} %else Requires(pre): %fillup_prereq %insserv_prereq %endif %description Autossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic. The idea and the mechanism are from rstunnel (Reliable SSH Tunnel), but implemented in C. The author's view is that it is not as fiddly as rstunnel to get to work. Connection monitoring using a loop of port forwardings. Backs off on rate of connection attempts when experiencing rapid failures such as connection refused. %prep %setup cp %{S:4} . cp %{S:5} . %build %configure %__make %{?jobs:-j%jobs} %install %makeinstall %__mkdir_p %{buildroot}%{_sbindir} %if %{with_systemd} %__install -D -m 444 %{S:3} %{buildroot}%{_unitdir}/autossh@.service ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcautossh %else %__install -D -m 755 %{S:1} %{buildroot}%{_initrddir}/autossh %__ln_s -f %{_initrddir}/autossh %{buildroot}%{_sbindir}/rcautossh %__install -D -m 644 %{S:2} %{buildroot}%{_fillupdir}/sysconfig.autossh %endif %__rm "$RPM_BUILD_ROOT/usr/share/doc/autossh"/{CHANGES,README} %__rm -rf "%{buildroot}%{_datadir}/examples" %if %{with_systemd} %pre %service_add_pre %{name}.service %preun %service_del_preun %{name}.service %endif %post %if %{with_systemd} %service_add_post %{name}.service %else %fillup_only %endif %postun %if %{with_systemd} %service_del_postun %{name}.service %else %insserv_cleanup %endif %files %defattr(-, root, root, 0755) %doc CHANGES README README.SUSE.md my.conf %doc autossh.host rscreen %{_bindir}/autossh %if %{with_systemd} %{_unitdir}/%{name}@.service %else %{_initrddir}/autossh %{_fillupdir}/sysconfig.autossh %endif %{_sbindir}/rcautossh %doc %{_mandir}/man1/autossh.1* %changelog