File mdadm.spec of Package mdadm

#
# spec file for package mdadm
#
# 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
# 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/
#


Name:           mdadm
Version:        3.3.1
Release:        0
BuildRequires:  binutils-devel
BuildRequires:  groff
BuildRequires:  pkgconfig
BuildRequires:  sgmltool
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(systemd)
PreReq:         %fillup_prereq %insserv_prereq /sbin/mkinitrd
Recommends:     cron
Recommends:     smtp_daemon
Obsoletes:      raidtools
Url:            http://www.kernel.org/pub/linux/utils/raid/mdadm/
Summary:        Utility for Configuring MD Setup
License:        GPL-2.0
Group:          System/Base
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         https://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}.tar.xz
Source1:        Software-RAID.HOWTO.tar.bz2
Source2:        sysconfig.mdadm
Source7:        mdadm.cron

# PATCH-FEATURE-SLE failfast Fate#311379 nfbrown@suse.de
Patch1:         failfast
# PATCH-FEATURE-SLE failfast Fate#311379 nfbrown@suse.de
Patch2:         display-timeout-status
# PATCH-FIX-SLE bnc808647-retry-failed-removes.patch bnc#808647 nfbrown@suse.de
Patch3:         bnc808647-retry-failed-removes.patch
# PATCH-FIX-UPSTREAM 0001-Makefile-install-mdadm-grow-continue-.service.patch nfbrown@suse.de
Patch4:         0001-Makefile-install-mdadm-grow-continue-.service.patch
# PATCH-FIX-UPSTREAM 0001-Grow-fix-removal-of-line-in-wrong-case.patch bnc#881530 nfbrown@suse.de
Patch5:         0001-Grow-fix-removal-of-line-in-wrong-case.patch
# PATCH-FIX-UPSREAM 0001-IMSM-Add-warning-message-when-assemble-spanned-conta.patch bnc#882634 nfbrown@suse.de
Patch6:         0001-IMSM-Add-warning-message-when-assemble-spanned-conta.patch
# PATCH-FIX-UPSTREAM 0001-Grow-Do-not-try-to-restart-if-reshape-is-running.patch bnc#887773 nfbrown@suse.de
Patch7:         0001-Grow-Do-not-try-to-restart-if-reshape-is-running.patch

%define _udevdir %(pkg-config --variable=udevdir udev)
%define _systemdshutdowndir %{_unitdir}/../system-shutdown

%description
Mdadm is a program that can be used to control Linux md devices. It is
intended to provide all the functionality of the mdtools and raidtools
programs but with a very different interface.

%prep
%setup -q -a1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

%build
make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error" SUSE=yes
cd Software-RAID.HOWTO
sgml2html Software-RAID.HOWTO.sgml
sgml2txt Software-RAID.HOWTO.sgml

%install
make install install-systemd install-udev DESTDIR=%{buildroot} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_udevdir} SUSE=yes
rm -rf %{buildroot}/lib/udev
install -d %{buildroot}%{_var}/adm/fillup-templates
install -d %{buildroot}{%{_sbindir}
install -d %{buildroot}/etc/cron.daily
install -m 755 %{S:7} %{buildroot}/etc/cron.daily/mdadm
install -m 644 %{S:2} %{buildroot}%{_var}/adm/fillup-templates/
install -d %{buildroot}%{_systemdshutdowndir}

%post
%{?regenerate_initrd_post}
%fillup_only

%postun
%{?regenerate_initrd_post}
%{insserv_cleanup}

%posttrans
%{?regenerate_initrd_posttrans}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING ChangeLog README.initramfs TODO mdadm.conf-example mkinitramfs
%doc Software-RAID.HOWTO/Software-RAID.HOWTO*{.txt,.html}
%doc %{_mandir}/man?/*
/sbin/*
%{_var}/adm/fillup-templates/sysconfig.mdadm
%{_udevdir}/rules.d/63-md-raid-arrays.rules
%{_udevdir}/rules.d/64-md-raid-assembly.rules
%dir /etc/cron.daily
/etc/cron.daily/mdadm
%{_systemdshutdowndir}/mdadm.shutdown
%{_unitdir}/mdmon@.service
%{_unitdir}/mdmonitor.service
%{_unitdir}/mdadm-last-resort@.timer
%{_unitdir}/mdadm-last-resort@.service
%{_unitdir}/mdadm-grow-continue@.service
%dir %{_unitdir}/../scripts
%{_unitdir}/../scripts/mdadm_env.sh

%changelog
openSUSE Build Service is sponsored by