File multipath-tools.spec of Package multipath-tools.4677

# spec file for package multipath-tools
# 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

%define version_unconverted 0.6.2+suse20170912.f76643c6ada3

Name:           multipath-tools
BuildRequires:  device-mapper-devel
BuildRequires:  libaio-devel
BuildRequires:  libudev-devel
BuildRequires:  liburcu-devel
BuildRequires:  readline-devel
BuildRequires:  udev
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(systemd)
Requires:       device-mapper >= 1.2.78
Requires:       kpartx
PreReq:         %insserv_prereq %fillup_prereq coreutils grep
Version:        0.6.2+suse20170912.f76643c6ada3
Release:        0
Summary:        Tools to Manage Multipathed Devices with the device-mapper
License:        GPL-2.0
Group:          System/Base
%define has_systemd 1
Source:         multipath-tools-%{version}.tar.xz
Source1:        multipath.conf
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %suse_version > 1220
%define         _sysdir usr/lib
%define         _sysdir lib

This package provides the tools to manage multipathed devices by
instructing the device-mapper multipath module what to do. The tools

- multipath: scans the system for multipathed devices, assembles
   them, and updates the device-mapper's maps

- multipathd: waits for maps events then execs multipath

- devmap-name: provides a meaningful device name to udev for devmaps

- kpartx: maps linear devmaps to device partitions, which makes
multipath maps partionable

%package -n kpartx
Summary:        Manages partition tables on device-mapper devices
Group:          System/Base
Requires:       device-mapper

%description -n kpartx
The kpartx program maps linear devmaps to device partitions, which
makes multipath maps partionable.

%package devel
Summary:        Development libraries for multipath-tools
Group:          Development/Libraries/Other
Requires:       device-mapper

%description devel
This package contains the development libraries for multipath-tools
and libmpath_persist.

%setup -q -n multipath-tools-%{version}

make CC="%__cc" OPTFLAGS="$RPM_OPT_FLAGS" LIB=%{_lib} SYSTEMDPATH=%{_sysdir}

make DESTDIR=$RPM_BUILD_ROOT LIB=%{_lib} SYSTEMDPATH=%{_sysdir} install
mkdir -p $RPM_BUILD_ROOT/var/cache/multipath/
rm $RPM_BUILD_ROOT/%_lib/
rm $RPM_BUILD_ROOT/%_lib/
rm $RPM_BUILD_ROOT/%_lib/
mkdir -p $RPM_BUILD_ROOT/usr/sbin
ln -sf /usr/sbin/service $RPM_BUILD_ROOT/usr/sbin/rcmultipathd
mkdir -p $RPM_BUILD_ROOT/usr/lib/modules-load.d
install -m 644 -D %{SOURCE1} "%buildroot/usr/lib/modules-load.d/multipath.conf"

[ -f /.buildenv ] && exit 0
if [ -f /etc/init.d/multipathd ] && dmsetup --target multipath table | grep -q multipath ; then
  /etc/init.d/multipathd stop
  %service_add_pre multipathd.socket
  %service_add_pre multipathd.service

[ -f /.buildenv ] && exit 0
if dmsetup --target multipath table | grep -q multipath ; then
  %service_add_post multipathd.socket
  %service_add_post multipathd.service
exit 0

%service_del_preun multipathd.service
%service_del_preun multipathd.socket

%service_del_postun multipathd.service
%service_del_postun multipathd.socket


%attr (0700, root, root) /var/cache/multipath
%dir /%{_sysdir}/systemd/system
%dir /usr/lib/modules-load.d

%files devel

%files -n kpartx

openSUSE Build Service is sponsored by