File mrsh.spec of Package mrsh
#
# spec file for package mrsh
#
# 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 http://bugs.opensuse.org/
#
%if 0%{?suse_version} >= 1230
%define have_systemd 1
%endif
Name: mrsh
Version: 2.12
Release: 0
Summary: Remote shell program that uses munge authentication
License: GPL-2.0+
Group: Productivity/Clustering/Computing
Url: https://github.com/chaos/mrsh
Source0: https://github.com/chaos/mrsh/archive/%{version}.tar.gz
Patch1: services-Do-not-require-non-standard-entries-in-etc-services.patch
Patch2: mrlogin-Don-t-use-union-wait.patch
Patch3: autogen.sh-Add-force-to-libtoolize.patch
Patch4: Include-grp.h.patch
BuildRequires: munge-devel >= 0.1-0
BuildRequires: ncurses-devel
BuildRequires: pam-devel
BuildRequires: pkg-config
%if 0%{?have_systemd}
BuildRequires: systemd-devel
Requires(post): systemd
%endif
# support re-run of autogen
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Remote shell programs that use munge authentication rather than
reserved ports for security.
%package -n %{name}-server
Summary: Servers for remote access commands (mrsh, mrlogin, mrcp)
Group: System/Daemons
Requires: mrsh
Requires: tcpd
%if 0%{!?have_systemd}
Requires: xinetd
%endif
%description -n %{name}-server
Server daemons for remote access commands (mrsh, mrlogin, mrcp)
%package -n %{name}-rsh-compat
Summary: Rsh compatibility package for mrcp/mrlogin/mrsh
Group: System/Base
Requires: mrsh = %version
Provides: rsh
Conflicts: otherproviders(rsh)
%description -n %{name}-rsh-compat
This package provides rsh compatibility for mrcp/mrlogin/mrsh
%package -n %{name}-rsh-server-compat
Summary: Rsh server compatibility package for mrlogind/mrshd
Group: System/Daemons
Requires: mrsh-server = %version
Provides: rsh-server
Conflicts: otherproviders(rsh-server)
%description -n %{name}-rsh-server-compat
This package provides rsh server compatibility for mrlogind/mrshd
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
./autogen.sh
%if 0%{!?suse_version:1310}%{?suse_version} < 1310
%define addflags CFLAGS+=-fpie LDFLAGS+=-pie
%endif
%configure
make %{?_smp_mflags} %{?addflags}
%install
DESTDIR="%{buildroot}" make install
ln -sf in.mrlogind %{buildroot}%{_sbindir}/in.rlogind
ln -sf in.mrshd %{buildroot}%{_sbindir}/in.rshd
for i in mrsh mrlogin
do
sed -i 's#\(account\s\+include\s\+\)system-auth#\1common-account#' %{buildroot}/%{_sysconfdir}/pam.d/$i
sed -i 's#\(session\s\+include\s\+\)system-auth#\1common-session#' %{buildroot}/%{_sysconfdir}/pam.d/$i
done
%if 0%{!?have_systemd}
sed -i 's#disable\s*= yes#disable = no#' %{buildroot}/etc/xinetd.d/mrlogind
sed -i 's#disable\s*= yes#disable = no#' %{buildroot}/etc/xinetd.d/mrshd
%endif
%pre server
%if 0%{?have_systemd}
%service_add_pre mrshd.socket mrlogind.socket
%endif
%post server
%if 0%{?have_systemd}
%service_add_post mrshd.socket mrlogind.socket
%else
%restart_on_update xinetd
%endif
%if 0%{?suse_version} > 1320 || 0%{?sle_version} > 120100
%define service_arg 1
%endif
%preun server
%if 0%{?have_systemd}
%service_del_preun %{?service_arg:-f} mrshd.socket mrlogind.socket
%endif
%postun server
%if 0%{?have_systemd}
%service_del_postun %{?service_arg:-n} mrshd.socket mrlogind.socket
%else
%restart_on_update xinetd
%endif
%files
%defattr(-,root,root)
%doc NEWS README ChangeLog COPYING DISCLAIMER DISCLAIMER.UC
%{_mandir}/man1/mrcp.1*
%{_mandir}/man1/mrsh.1*
%{_mandir}/man1/mrlogin.1*
%{_bindir}/mrcp
%{_bindir}/mrsh
%{_bindir}/mrlogin
%files -n %{name}-server
%defattr(-,root,root)
%{!?have_systemd:%attr(644,root,root) %config(noreplace) /etc/xinetd.d/mrshd}
%{!?have_systemd:%attr(644,root,root) %config(noreplace) /etc/xinetd.d/mrlogind}
%attr(644,root,root) %config(noreplace) /etc/pam.d/mrsh
%attr(644,root,root) %config(noreplace) /etc/pam.d/mrlogin
%{?have_systemd:%{_unitdir}/*}
%{_mandir}/man8/in.mrlogind.8*
%{_mandir}/man8/in.mrshd.8*
%{_mandir}/man8/mrlogind.8*
%{_mandir}/man8/mrshd.8*
%{_sbindir}/in.mrlogind
%{_sbindir}/in.mrshd
%files -n %{name}-rsh-compat
%defattr(-,root,root)
%{_mandir}/man1/rcp.1*
%{_mandir}/man1/rsh.1*
%{_mandir}/man1/rlogin.1*
%{_bindir}/rcp
%{_bindir}/rsh
%{_bindir}/rlogin
%files -n %{name}-rsh-server-compat
%defattr(-,root,root)
%{_mandir}/man8/in.rlogind.8*
%{_mandir}/man8/in.rshd.8*
%{_mandir}/man8/rlogind.8*
%{_mandir}/man8/rshd.8*
%{_sbindir}/in.rlogind
%{_sbindir}/in.rshd
%changelog