Accepting request 241673 from home:posophe:branches:security
Add systemd support for openSUSE > 12.2 OBS-URL: https://build.opensuse.org/request/show/241673 OBS-URL: https://build.opensuse.org/package/show/security/autossh?expand=0&rev=15
This commit is contained in:
parent
10aa0ec596
commit
c4c3c89525
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Jul 20 21:50:18 UTC 2014 - p.drouand@gmail.com
|
||||
|
||||
- Add systemd support for openSUSE > 12.2
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 27 12:17:11 UTC 2013 - multyrealm@gmail.com
|
||||
|
||||
|
11
autossh.service
Normal file
11
autossh.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=AutoSSH service for port 2222
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Environment="AUTOSSH_GATETIME=0"
|
||||
ExecStart=/usr/bin/autossh -M 0 -NL 2222:localhost:2222 -o TCPKeepAlive=yes foo@bar.com
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
45
autossh.spec
45
autossh.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package autossh
|
||||
#
|
||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2014 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
|
||||
@ -15,6 +15,11 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
%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
|
||||
@ -27,13 +32,19 @@ Url: http://www.harding.motd.ca/autossh/
|
||||
Source: http://www.harding.motd.ca/autossh/autossh-1.4c.tgz
|
||||
Source1: autossh.init
|
||||
Source2: autossh.conf
|
||||
Source3: autossh.service
|
||||
Patch0: autossh-makefile-destdir.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
# configure checks is the ssh client exists
|
||||
BuildRequires: openssh
|
||||
Requires: openssh
|
||||
Requires(pre): %insserv_prereq %fillup_prereq
|
||||
%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
|
||||
@ -54,30 +65,52 @@ such as connection refused.
|
||||
|
||||
%install
|
||||
%makeinstall
|
||||
%__install -D -m 755 %{S:1} %{buildroot}%{_initrddir}/autossh
|
||||
%__mkdir_p %{buildroot}%{_sbindir}
|
||||
%if %{with_systemd}
|
||||
%__install -D -m 755 %{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}/var/adm/fillup-templates/sysconfig.autossh
|
||||
%endif
|
||||
%__rm "$RPM_BUILD_ROOT/usr/share/doc/autossh"/{CHANGES,README}
|
||||
%__rm -rf "%{buildroot}%{_datadir}/examples"
|
||||
|
||||
%clean
|
||||
%__rm -rf "%{buildroot}"
|
||||
%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
|
||||
%doc autossh.host rscreen
|
||||
%{_bindir}/autossh
|
||||
%if %{with_systemd}
|
||||
%{_unitdir}/%{name}.service
|
||||
%else
|
||||
%{_initrddir}/autossh
|
||||
%{_sbindir}/rcautossh
|
||||
/var/adm/fillup-templates/sysconfig.autossh
|
||||
%endif
|
||||
%{_sbindir}/rcautossh
|
||||
%doc %{_mandir}/man1/autossh.1*
|
||||
|
||||
%changelog
|
||||
|
Loading…
x
Reference in New Issue
Block a user