File mdadm.spec of Package mdadm.2874

#
# 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
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.bz2
Source1:        Software-RAID.HOWTO.tar.bz2
Source2:        sysconfig.mdadm
Source3:        mdadmd
Source4:        boot.md
Source5:        mkinitrd-setup.sh
Source6:        mkinitrd-boot.sh
Source7:        mdadm.cron
Source8:        mdadm.shutdown
Source9:        systemd-mdadm-last-resort@.timer
Source10:       systemd-mdadm-last-resort@.service
# PATCH-FIX-UPSTREAM config-set-auto_seen-after-processing-the-auto-line.patch upstream-bugfix nfbrown@suse.de
Patch1:         config-set-auto_seen-after-processing-the-auto-line.patch
# PATCH-FIX-UPSTREAM DDF-allow-for-possibility-that-there-is-no-secondary.patch upstream-bugfix nfbrown@suse.de
Patch2:         DDF-allow-for-possibility-that-there-is-no-secondary.patch
# PATCH-FIX-UPSTREAM Make-IRs-and-run-work-properly-for-containers.patch upstream-bugfix nfbrown@suse.de
Patch3:         Make-IRs-and-run-work-properly-for-containers.patch
# PATCH-FIX-UPSTREAM mdmon-honour-offroot-again.patch upstream-bugfix nfbrown@suse.de
Patch4:         mdmon-honour-offroot-again.patch
# PATCH-FIX-UPSTREAM DDF-brief_examine_subarrays_ddf-print-array-name.patch upstream-bugfix nfbrown@suse.de
Patch5:         DDF-brief_examine_subarrays_ddf-print-array-name.patch
# PATCH-FIX-UPSTREAM DDF-factor-out-array-name-generation.patch upstream-bugfix nfbrown@suse.de
Patch6:         DDF-factor-out-array-name-generation.patch
# PATCH-FIX-UPSTREAM DDF-handle-fake-RAIDs-with-changing-subarray-UUIDs.patch upstream-bugfix nfbrown@suse.de
Patch7:         DDF-handle-fake-RAIDs-with-changing-subarray-UUIDs.patch
# PATCH-FIX-UPSTREAM DDF-compare_super_ddf-fix-sequence-number-check.patch upstream-bugfix nfbrown@suse.de
Patch8:         DDF-compare_super_ddf-fix-sequence-number-check.patch
# PATCH-FIX-UPSTREAM Monitor-don-t-set-arrays-dirty-after-transition-to-r.patch upstream-bugfix nfbrown@suse.de
Patch9:         Monitor-don-t-set-arrays-dirty-after-transition-to-r.patch
# PATCH-FIX-UPSTREAM DDF-add_to_super_ddf-be-careful-with-workspace_lba.patch upstream-bugfix nfbrown@suse.de
Patch10:        DDF-add_to_super_ddf-be-careful-with-workspace_lba.patch
# PATCH-FIX-UPSTREAM Monitor-write-meta-data-in-readonly-state-sometimes.patch upstream-bugfix nfbrown@suse.de
Patch11:        Monitor-write-meta-data-in-readonly-state-sometimes.patch
# PATCH-FIX-UPSTREAM Assembe-fix-bug-in-force_array-it-wasn-t-forcing-pro.patch upstream-bugfix nfbrown@suse.de
Patch12:        Assembe-fix-bug-in-force_array-it-wasn-t-forcing-pro.patch
# PATCH-FEATURE-UPSTREAM Restructure-assemble_container_content-and-improve-m.patch bnc#832501 nfbrown@suse.de
Patch13:        Restructure-assemble_container_content-and-improve-m.patch
# PATCH-FEATURE-UPSTREAM Incremental-add-export-handling.patch bnc#832501 nfbrown@suse.de
Patch14:        Incremental-add-export-handling.patch
# PATCH-FEATURE-UPSTREAM udev-rules.degraded bnc#832501 nfbrown@suse.de
Patch15:        udev-rules.degraded
# PATCH-FEATURE-UPSTREAM Incremental-improve-support-for-DEVICE-based-restric.patch bnc#851993 nfbrown@suse.de
Patch16:        Incremental-improve-support-for-DEVICE-based-restric.patch
# PATCH-FIX-UPSTREAM Assemble-Incremental-don-t-hold-O_EXCL-on-mddev-afte.patch nfbrown@suse.de
Patch17:        Assemble-Incremental-don-t-hold-O_EXCL-on-mddev-afte.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
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1

%build
make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error"
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}
rm -rf %{buildroot}/lib/udev
install -d %{buildroot}%{_var}/adm/fillup-templates
install -d %{buildroot}{%{_sbindir},%{_sysconfdir}/init.d}
install -m 755 %{S:4} %{S:3} %{buildroot}%{_sysconfdir}/init.d/
install -d %{buildroot}/lib/mkinitrd/scripts
install -m 755 %{S:5} %{buildroot}/lib/mkinitrd/scripts/setup-md.sh
install -m 755 %{S:6} %{buildroot}/lib/mkinitrd/scripts/boot-md.sh
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/
ln -sf ../../etc/init.d/mdadmd %{buildroot}/%{_sbindir}/rcmdadmd
install -d %{buildroot}%{_systemdshutdowndir}
install -m 755 %{S:8} %{buildroot}%{_systemdshutdowndir}/mdadm.shutdown
install -m 644 %{S:9} %{buildroot}%{_unitdir}/mdadm-last-resort@.timer
install -m 644 %{S:10} %{buildroot}%{_unitdir}/mdadm-last-resort@.service

%post
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then
  echo "Skipping recreation of existing initial ramdisks, due"
  echo "to presence of /var/lib/no_initrd_recreation_by_suspend"
elif [ -x /sbin/mkinitrd ]; then
  /sbin/mkinitrd
fi

%{fillup_and_insserv -y boot.md}

%postun
%restart_on_update mdadmd
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then
  echo "Skipping recreation of existing initial ramdisks, due"
  echo "to presence of /var/lib/no_initrd_recreation_by_suspend"
elif [ -x /sbin/mkinitrd ]; then
  /sbin/mkinitrd
fi

%{insserv_cleanup}

%preun
%stop_on_removal mdadmd

%clean
rm -rf %{buildroot}

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

%changelog
openSUSE Build Service is sponsored by