# Conditional build:
# --without initrd -- build without initrd version
#
+%bcond_without initrd
Summary: Tool for creating and maintaining software RAID devices
Summary(pl): Narzêdzie do tworzenia i obs³ugi programowych macierzy RAID
Name: mdadm
-Version: 1.4.0
-Release: 3
+Version: 1.5.0
+Release: 1
License: GPL
Group: Base
Source0: http://www.cse.unsw.edu.au/~neilb/source/mdadm/%{name}-%{version}.tgz
-# Source0-md5: 8ba9ab8f77647dfc26b5729b70639450
+# Source0-md5: 765286c4a22e36b70ce2f817f0c4647c
Source1: %{name}.init
Source2: %{name}.sysconfig
-Patch0: %{name}-gkh.patch
-%{!?_without_initrd:BuildRequires: uClibc-static}
+%{!?without_initrd:BuildRequires: uClibc-static}
BuildRequires: groff
Obsoletes: mdctl
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%prep
%setup -q
-%patch0 -p1
%build
-%{!?_without_initrd:%{__make} mdadm.uclibc UCLIBC_GCC="%{_target_cpu}-uclibc-gcc %{rpmcflags} %{rpmldflags} -static"}
-%{!?_without_initrd:mv mdadm.uclibc initrd-mdadm}
-%{!?_without_initrd:%{__make} clean}
+%if %{with initrd}
+%{__make} mdadm.uclibc UCLIBC_GCC="%{_target_cpu}-uclibc-gcc %{rpmcflags} %{rpmldflags} -static"
+mv mdadm.uclibc initrd-mdadm
+%{__make} clean
+%{_target_cpu}-uclibc-gcc -DUCLIBC %{rpmcflags} %{rpmldflags} -static \
+ -o mdassemble mdassemble.c Assemble.c config.c dlink.c util.c
+mv mdassemble initrd-mdassemble
+%{__make} clean
+%endif
%{__make} \
CC="%{__cc}" \
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man{5,8},%{_sysconfdir}/{rc.d/init.d,sysconfig}}
-%{!?_without_initrd:install initrd-mdadm $RPM_BUILD_ROOT%{_sbindir}}
+%if %{with initrd}
+install initrd-mdadm $RPM_BUILD_ROOT%{_sbindir}
+install initrd-mdassemble $RPM_BUILD_ROOT%{_sbindir}
+ln -s initrd-mdadm $RPM_BUILD_ROOT%{_sbindir}/initrd-mdctl
+%endif
+
install mdadm $RPM_BUILD_ROOT%{_sbindir}
install *.5 $RPM_BUILD_ROOT%{_mandir}/man5
install mdadm.conf-example $RPM_BUILD_ROOT%{_sysconfdir}/mdadm.conf
ln -s mdadm $RPM_BUILD_ROOT%{_sbindir}/mdctl
-%{!?_without_initrd:ln -s initrd-mdadm $RPM_BUILD_ROOT%{_sbindir}/initrd-mdctl}
install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
%{_mandir}/man?/*
%attr(754,root,root) /etc/rc.d/init.d/%{name}
%attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/%{name}
+%if %{with initrd}
+%exclude %{_sbindir}/initrd-*
-%if %{?_without_initrd:0}%{!?_without_initrd:1}
%files initrd
%defattr(644,root,root,755)
-%attr(755,root,root) %{_sbindir}/initrd-mdadm
+%attr(755,root,root) %{_sbindir}/initrd-*
%endif