File mdadm.spec of Package mdadm.import4757

# spec file for package mdadm
# Copyright (c) 2011 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

# norootforbuild

Name:           mdadm
Version:        3.1.4
Release:        13.<RELEASE19>
BuildRequires:  sgmltool
PreReq:         %fillup_prereq %insserv_prereq
Obsoletes:      raidtools
AutoReqProv:    on
Group:          System/Base
License:        GPLv2+
Summary:        Utility for Configuring MD Setup
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         %{name}-%{version}.tar.bz2
Source1:        Software-RAID.HOWTO.tar.bz2
Source2:        sysconfig.mdadm
Source3:        mdadmd
Source7:        64-md-raid.rules
# PATCH-FIX-OPENSUSE Fix crash if /proc/mdstat lists 0.9 superblocks (should be upstreamed)
Patch2:         mdmon-0.9-superblock-crash.patch
Patch3:         super1-byteorder-fix

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.

    Neil Brown <>

%setup -q -a1
%patch2 -p1
%patch3 -p1

%{suse_update_config -f}
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-error"
cd Software-RAID.HOWTO
sgml2html Software-RAID.HOWTO.sgml
sgml2txt Software-RAID.HOWTO.sgml

install -d $RPM_BUILD_ROOT%{_var}/adm/fillup-templates
install -d $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/init.d}
install -d $RPM_BUILD_ROOT/lib/udev/devices
install -m 755 %{S:4} %{S:3} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/
install -m 755 %{S:6} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_var}/adm/fillup-templates/
ln -sf ../../etc/init.d/mdadmd $RPM_BUILD_ROOT/%{_sbindir}/rcmdadmd
rm -rf $RPM_BUILD_ROOT/var/run/mdadm
mkdir -p $RPM_BUILD_ROOT/var/run
ln -s mdadm $RPM_BUILD_ROOT/var/run/mdadm
install -d $RPM_BUILD_ROOT/lib/udev/rules.d
install -m 644 %_sourcedir/64-md-raid.rules $RPM_BUILD_ROOT/lib/udev/rules.d

[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%{fillup_and_insserv -y}
mkdir -p /dev/.mdadm
# replace the /var/run/mdadm directory (installed by sle11/11.1) with
# a symlink pointing to /dev/.mdadm. Do not do this when /var/run/mdadm is
# not empty, let /etc/init.d/ do it at the next reboot.
if test -e /var/run/mdadm -a ! /var/run/mdadm -ef /dev/.mdadm; then
	if ! rmdir /var/run/mdadm 2>/dev/null; then
		exit 0
	ln -s /dev/.mdadm /var/run/mdadm

%restart_on_update mdadmd
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup

%stop_on_removal mdadmd


%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?/*
%dir /lib/udev
%dir /lib/udev/devices
%ghost /var/run/mdadm
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
%dir /lib/udev
%dir /lib/udev/rules.d