make systemd units optional for rhel > 6 and fedora

This commit is contained in:
Petr Lautrbach 2014-04-09 13:36:19 +02:00
parent 5188d21f8c
commit ac82bdc72a
1 changed files with 14 additions and 0 deletions

View File

@ -81,9 +81,13 @@ Group: System Environment/Daemons
Requires: openssh = %{version}-%{release}
Requires(pre): /usr/sbin/useradd
Requires: pam >= 1.0.1-3
%if 0%{?fedora}
%if 0%{?rhel} > 6
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
%endif
%package server-sysvinit
Summary: The SysV initscript to manage the OpenSSH server.
@ -247,11 +251,15 @@ install -m755 %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/sshd
install -m644 %{SOURCE7} $RPM_BUILD_ROOT/etc/sysconfig/sshd
install -m644 %{SOURCE14} $RPM_BUILD_ROOT/etc/ssh/sshd_config
install -m755 %{SOURCE13} $RPM_BUILD_ROOT/%{_sbindir}/sshd-keygen
%if 0%{?fedora}
%if 0%{?rhel} > 6
install -d -m755 $RPM_BUILD_ROOT/%{_unitdir}
install -m644 %{SOURCE9} $RPM_BUILD_ROOT/%{_unitdir}/sshd@.service
install -m644 %{SOURCE10} $RPM_BUILD_ROOT/%{_unitdir}/sshd.socket
install -m644 %{SOURCE11} $RPM_BUILD_ROOT/%{_unitdir}/sshd.service
install -m644 %{SOURCE12} $RPM_BUILD_ROOT/%{_unitdir}/sshd-keygen.service
%endif
%endif
install -m755 contrib/ssh-copy-id $RPM_BUILD_ROOT%{_bindir}/
install contrib/ssh-copy-id.1 $RPM_BUILD_ROOT%{_mandir}/man1/
@ -284,6 +292,8 @@ getent passwd sshd >/dev/null || \
useradd -c "Privilege-separated SSH" -u %{sshd_uid} -g sshd \
-s /sbin/nologin -r -d /var/empty/sshd sshd 2> /dev/null || :
%if 0%{?fedora}
%if 0%{?rhel} > 6
%post server
%systemd_post sshd.service sshd.socket
@ -304,6 +314,8 @@ getent passwd sshd >/dev/null || \
%triggerpostun -n openssh-server-sysvinit -- openssh-server < 5.8p2-12
/sbin/chkconfig --add sshd >/dev/null 2>&1 || :
%endif
%endif
%files
%defattr(-,root,root)
@ -352,6 +364,8 @@ getent passwd sshd >/dev/null || \
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config
%attr(0644,root,root) %config(noreplace) /etc/pam.d/sshd
%attr(0640,root,root) %config(noreplace) /etc/sysconfig/sshd
%if 0%{?fedora}
%if 0%{?rhel} > 6
%attr(0644,root,root) %{_unitdir}/sshd.service
%attr(0644,root,root) %{_unitdir}/sshd@.service
%attr(0644,root,root) %{_unitdir}/sshd.socket