From 6db3aa41da4e9b44d8f2d2ffd7fff3448328db4f Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 4 Dec 2018 08:26:17 +0000 Subject: [PATCH] - updated to 4.1, partial merge from PLD --- mdadm-udev-rules-paths.patch | 37 +++++++++++++++++-- mdadm.spec | 69 +++++++++++++----------------------- 2 files changed, 59 insertions(+), 47 deletions(-) diff --git a/mdadm-udev-rules-paths.patch b/mdadm-udev-rules-paths.patch index 439dc4d..00d34c8 100644 --- a/mdadm-udev-rules-paths.patch +++ b/mdadm-udev-rules-paths.patch @@ -1,5 +1,22 @@ ---- udev-md-raid-arrays.rules.orig 2015-08-03 06:17:13.000000000 +0000 -+++ udev-md-raid-arrays.rules 2015-09-01 08:57:31.874593251 +0000 +diff -ur mdadm-4.1.orig/udev-md-clustered-confirm-device.rules mdadm-4.1/udev-md-clustered-confirm-device.rules +--- mdadm-4.1.orig/udev-md-clustered-confirm-device.rules 2018-10-01 18:26:06.000000000 +0000 ++++ mdadm-4.1/udev-md-clustered-confirm-device.rules 2018-12-04 08:16:15.690403000 +0000 +@@ -13,9 +13,9 @@ + # Based on the received UUID, node confirms the device if + # it is found by blkid, otherwise the node reports it is + # missing. +-PROGRAM="BINDIR/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{.md.newdevice} = "$result" ++PROGRAM="/sbin/blkid -o device -t UUID_SUB=$env{DEVICE_UUID}", ENV{.md.newdevice} = "$result" + +-ENV{.md.newdevice}!="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$env{.md.newdevice}" +-ENV{.md.newdevice}=="", RUN+="BINDIR/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing" ++ENV{.md.newdevice}!="", RUN+="/sbin/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:$env{.md.newdevice}" ++ENV{.md.newdevice}=="", RUN+="/sbin/mdadm --manage $env{DEVNAME} --cluster-confirm $env{RAID_DISK}:missing" + + LABEL="clustermd_end" +diff -ur mdadm-4.1.orig/udev-md-raid-arrays.rules mdadm-4.1/udev-md-raid-arrays.rules +--- mdadm-4.1.orig/udev-md-raid-arrays.rules 2018-10-01 18:26:06.000000000 +0000 ++++ mdadm-4.1/udev-md-raid-arrays.rules 2018-12-04 08:16:51.490403000 +0000 @@ -17,7 +17,7 @@ ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end" LABEL="md_ignore_state" @@ -19,3 +36,19 @@ +ENV{MD_MON_THIS}=="?*", PROGRAM="/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdmon@%c.service" LABEL="md_end" +diff -ur mdadm-4.1.orig/udev-md-raid-assembly.rules mdadm-4.1/udev-md-raid-assembly.rules +--- mdadm-4.1.orig/udev-md-raid-assembly.rules 2018-10-01 18:26:06.000000000 +0000 ++++ mdadm-4.1/udev-md-raid-assembly.rules 2018-12-04 08:17:07.490403000 +0000 +@@ -30,9 +30,9 @@ + + # remember you can limit what gets auto/incrementally assembled by + # mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY' +-ACTION=="add|change", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}" ++ACTION=="add|change", IMPORT{program}="/sbin/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}" + ACTION=="add|change", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer" +-ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="BINDIR/mdadm -If $name --path $env{ID_PATH}" +-ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="BINDIR/mdadm -If $name" ++ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}" ++ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name" + + LABEL="md_inc_end" diff --git a/mdadm.spec b/mdadm.spec index 7f0b026..b481aa6 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -7,20 +7,23 @@ Summary: Tool for creating and maintaining software RAID devices Summary(pl.UTF-8): Narzędzie do tworzenia i obsługi programowych macierzy RAID Name: mdadm -Version: 4.0 +Version: 4.1 Release: 1 License: GPL v2+ Group: Base Source0: https://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}.tar.xz -# Source0-md5: 2cb4feffea9167ba71b5f346a0c0a40d +# Source0-md5: 51bf3651bd73a06c413a2f964f299598 Source1: %{name}.init Source2: %{name}.sysconfig Source3: %{name}.cron Source4: %{name}-checkarray Patch0: %{name}-udev-rules-paths.patch URL: https://www.kernel.org/pub/linux/utils/raid/mdadm/ +BuildRequires: dlm-devel BuildRequires: groff -BuildRequires: rpmbuild(macros) >= 1.213 +BuildRequires: rpmbuild(macros) >= 1.671 +BuildRequires: tar >= 1:1.22 +BuildRequires: xz %if %{with initrd} %if %{with dietlibc} BuildRequires: dietlibc-static @@ -28,13 +31,10 @@ BuildRequires: dietlibc-static BuildRequires: glibc-static %endif %endif -BuildRequires: rpmbuild(macros) >= 1.268 -BuildRequires: tar >= 1:1.22 -BuildRequires: xz Requires(post,preun): /sbin/chkconfig Requires: /sbin/chkconfig Requires: rc-scripts >= 0.4.2.4-2 -Suggests: crondaemon +Suggests: cronjobs %{!?with_initrd:Obsoletes: mdadm-initrd < %{version}-%{release}} Obsoletes: mdctl BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) @@ -67,7 +67,7 @@ skonsolidowane na potrzeby initrd. %prep %setup -q -%patch0 -p0 +%patch0 -p1 %build %if %{with initrd} @@ -75,38 +75,17 @@ skonsolidowane na potrzeby initrd. %{__make} mdadm \ CC="diet %{__cc} %{rpmcflags} %{rpmcppflags} %{rpmldflags} -Os -static" \ CWFLAGS="-Wall" -mv -f mdadm initrd-mdadm -%{__make} clean -diet %{__cc} -DUCLIBC -DMDASSEMBLE_AUTO -DMDASSEMBLE %{rpmcflags} %{rpmcppflags} %{rpmldflags} -Os -static \ - -o initrd-mdassemble \ - mdassemble.c Assemble.c Manage.c config.c policy.c dlink.c util.c lib.c \ - super0.c super1.c super-ddf.c super-intel.c sha1.c crc32.c sg_io.c mdstat.c \ - platform-intel.c probe_roms.c sysfs.c super-mbr.c super-gpt.c mdopen.c maps.c xmalloc.c +%{__mv} mdadm initrd-mdadm %else %{__make} mdadm.static \ CC="%{__cc}" \ CFLAGS="%{rpmcflags} %{rpmcppflags}" \ LDFLAGS="%{rpmldflags}" -mv -f mdadm.static initrd-mdadm -%{__make} clean -%{__cc} -DMDASSEMBLE_AUTO -DMDASSEMBLE %{rpmcflags} %{rpmcppflags} %{rpmldflags} -DHAVE_STDINT_H -static \ - -o initrd-mdassemble \ - mdassemble.c Assemble.c Manage.c config.c policy.c dlink.c util.c lib.c \ - super0.c super1.c super-ddf.c super-intel.c sha1.c crc32.c sg_io.c mdstat.c \ - platform-intel.c probe_roms.c sysfs.c super-mbr.c super-gpt.c mdopen.c maps.c xmalloc.c +%{__mv} mdadm.static initrd-mdadm %endif %{__make} clean %endif -%{__make} mdassemble \ - MDASSEMBLE_AUTO=1 \ - CC="%{__cc}" \ - CFLAGS="%{rpmcflags} %{rpmcppflags}" \ - LDFLAGS="%{rpmldflags}" \ - SYSCONFDIR="%{_sysconfdir}" -mv mdassemble regular-mdassemble -%{__make} clean - %{__make} all mdadm mdadm.8 \ CC="%{__cc}" \ CFLAGS="%{rpmcflags} %{rpmcppflags}" \ @@ -117,21 +96,18 @@ mv mdassemble regular-mdassemble %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man{5,8},/etc/{rc.d/init.d,sysconfig,cron.d},/lib/udev/rules.d} +install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man{5,8}} \ + $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.d} + +%{__make} install install-udev \ + DESTDIR=$RPM_BUILD_ROOT %if %{with initrd} install -d $RPM_BUILD_ROOT%{_libdir}/initrd install -p initrd-mdadm $RPM_BUILD_ROOT%{_libdir}/initrd/mdadm -install -p initrd-mdassemble $RPM_BUILD_ROOT%{_libdir}/initrd/mdassemble ln -s mdadm $RPM_BUILD_ROOT%{_libdir}/initrd/mdctl %endif -install -p regular-mdassemble $RPM_BUILD_ROOT%{_sbindir}/mdassemble -install -p mdadm $RPM_BUILD_ROOT%{_sbindir} - -cp -p md*.5 $RPM_BUILD_ROOT%{_mandir}/man5 -cp -p md*.8 $RPM_BUILD_ROOT%{_mandir}/man8 - cp -p mdadm.conf-example $RPM_BUILD_ROOT%{_sysconfdir}/mdadm.conf ln -s mdadm $RPM_BUILD_ROOT%{_sbindir}/mdctl @@ -142,8 +118,6 @@ cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name} cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/cron.d/mdadm-checkarray install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/mdadm-checkarray -cp -p udev-md-raid-arrays.rules $RPM_BUILD_ROOT/lib/udev/rules.d/64-md-raid.rules - %clean rm -rf $RPM_BUILD_ROOT @@ -157,27 +131,32 @@ if [ "$1" = "0" ]; then /sbin/chkconfig --del mdadm fi +%postun +/sbin/ldconfig + %files %defattr(644,root,root,755) %doc ANNOUNCE* ChangeLog TODO %attr(755,root,root) %{_sbindir}/mdadm %attr(755,root,root) %{_sbindir}/mdadm-checkarray -%attr(755,root,root) %{_sbindir}/mdassemble %attr(755,root,root) %{_sbindir}/mdctl +%attr(755,root,root) %{_sbindir}/mdmon +/lib/udev/rules.d/01-md-raid-creating.rules +/lib/udev/rules.d/63-md-raid-arrays.rules +/lib/udev/rules.d/64-md-raid-assembly.rules +/lib/udev/rules.d/69-md-clustered-confirm-device.rules %attr(640,root,root) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mdadm.conf +%{_mandir}/man4/md.4* %{_mandir}/man5/mdadm.conf.5* %{_mandir}/man8/mdadm.8* -%{_mandir}/man8/mdassemble.8* %{_mandir}/man8/mdmon.8* %attr(754,root,root) /etc/rc.d/init.d/%{name} %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} %config(noreplace) %attr(640,root,root) /etc/cron.d/mdadm-checkarray -/lib/udev/rules.d/64-md-raid.rules %if %{with initrd} %files initrd %defattr(644,root,root,755) %attr(755,root,root) %{_libdir}/initrd/mdadm -%attr(755,root,root) %{_libdir}/initrd/mdassemble %attr(755,root,root) %{_libdir}/initrd/mdctl %endif -- 2.46.0