File rdma.spec of Package rdma.4563

#
# spec file for package rdma
#
# Copyright (c) 2017 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/
#


%define ofed_pkg_version 5.0

%if 0%{?suse_version} > 1230 || 0%{?rhel_version} > 600 || 0%{?centos_version} > 600 || 0%{?fedora_version} >= 20 || 0%{?el7}%{?fc20}%{?fc21}%{?fc22}
%bcond_without  systemd
%else
%bcond_with     systemd
%endif

Summary:        Infiniband/iWARP Kernel Module Initializer
License:        GPL-2.0+
Group:          System Environment/Base
Name:           rdma
Version:        2.1
Release:        0
Source0:        rdma.conf
Source1:        rdma.udev-ipoib-naming.rules
Source6:        rdma.service
Source7:        rdma.sbin
Source8:        rdma.udev-rules
Source9:        rdma-init-kernel.8
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%if 0%suse_version < 1310
BuildRequires:  systemd
%else
BuildRequires:  systemd-rpm-macros
%endif
BuildRequires:  udev
Requires:       udev >= 095
Provides:       ofed = %{ofed_pkg_version}
Obsoletes:      ofed < %{ofed_pkg_version}
Provides:       rdma.service = %{ofed_pkg_version}
%if %{with systemd}
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
%endif

%description 
User space initialization scripts for the kernel InfiniBand/iWARP drivers

%prep

%build

%install
rm -rf %{buildroot}
install -d %{buildroot}%{_sysconfdir}/%{name}
install -d %{buildroot}/usr/lib/udev/rules.d
install -d %{buildroot}%{_sysconfdir}/sysconfig/network-scripts
install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_unitdir}
install -d %{buildroot}%{_mandir}/man8

# Stuff to go into the base package
install -m 0644 %{S:0} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
install -m 0644 %{S:1} %{buildroot}/usr/lib/udev/rules.d/70-persistent-ipoib.rules
%if %{with systemd}
install -m 0644 %{S:6} %{buildroot}%{_unitdir}/%{name}.service
install -m 0755 %{S:7} %{buildroot}%{_sbindir}/rdma-init-kernel
%endif
install -m 0644 %{S:8} %{buildroot}/usr/lib/udev/rules.d/98-rdma.rules

install -m 0644 %{SOURCE9} %{buildroot}%{_mandir}/man8/rdma-init-kernel.8
gzip -9 %{buildroot}%{_mandir}/man8/rdma-init-kernel.8

ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcrdma 

# START BIG SYSTEMD
%if %{with systemd}
%pre
%if 0%{?suse_version}
%service_add_pre %{name}.service
%endif

%preun
%if 0%{?suse_version}
%service_del_preun %{name}.service
%else
%systemd_preun %{name}.service
%endif

%post
%if 0%{?suse_version}
%service_add_post %{name}.service
%else
%systemd_post %{name}.service
%endif

%postun
%if 0%{?suse_version}
%service_del_postun %{name}.service
%else
%systemd_postun_with_restart %{name}.service
%endif
%endif
# /END BIG SYSTEMD

%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
/usr/lib/udev/rules.d/*
%{_unitdir}/%{name}.service
%{_sbindir}/rdma-init-kernel
%{_sbindir}/rcrdma
%{_mandir}/man8/rdma-init-kernel.8.gz

%changelog
openSUSE Build Service is sponsored by