Skip to content

Commit

Permalink
packages: add mdadm package for software RAID support
Browse files Browse the repository at this point in the history
  • Loading branch information
tzneal committed Jun 5, 2024
1 parent efbbe1a commit 9e468b2
Show file tree
Hide file tree
Showing 8 changed files with 888 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
From 1f0adcdadac76b8ef1f52cc19ce28c8af7f70488 Mon Sep 17 00:00:00 2001
From: Todd Neal <[email protected]>
Date: Thu, 9 May 2024 20:53:55 +0000
Subject: [PATCH] rename MAP_FILE -> FMAP_FILE to avoid issue with MAP_FILE
definition

---
Makefile | 6 +++---
mapfile.c | 8 ++++----
mdadm.h | 8 ++++----
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index cbdba49..254aab6 100644
--- a/Makefile
+++ b/Makefile
@@ -101,8 +101,8 @@ CONFFILEFLAGS = -DCONFFILE=\"$(CONFFILE)\" -DCONFFILE2=\"$(CONFFILE2)\"
RUN_DIR=/run/mdadm
CHECK_RUN_DIR=1
MAP_DIR=$(RUN_DIR)
-MAP_FILE = map
-MAP_PATH = $(MAP_DIR)/$(MAP_FILE)
+FMAP_FILE = map
+MAP_PATH = $(MAP_DIR)/$(FMAP_FILE)
MDMON_DIR = $(RUN_DIR)
# place for autoreplace cookies
FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
@@ -112,7 +112,7 @@ LIB_DIR=/usr/libexec/mdadm
COROSYNC:=$(shell [ -d /usr/include/corosync ] || echo -DNO_COROSYNC)
DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM)

-DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
+DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DFMAP_FILE=\"$(FMAP_FILE)\"
DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
diff --git a/mapfile.c b/mapfile.c
index f1f3ee2..e72cb0e 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -40,7 +40,7 @@
*
* The best place for the mapfile is /run/mdadm/map. Distros and users
* which have not switched to /run yet can choose a different location
- * at compile time via MAP_DIR and MAP_FILE.
+ * at compile time via MAP_DIR and FMAP_FILE.
*/
#include "mdadm.h"
#include <sys/file.h>
@@ -52,9 +52,9 @@
#define MAP_DIRNAME 3

char *mapname[4] = {
- MAP_DIR "/" MAP_FILE,
- MAP_DIR "/" MAP_FILE ".new",
- MAP_DIR "/" MAP_FILE ".lock",
+ MAP_DIR "/" FMAP_FILE,
+ MAP_DIR "/" FMAP_FILE ".new",
+ MAP_DIR "/" FMAP_FILE ".lock",
MAP_DIR
};

diff --git a/mdadm.h b/mdadm.h
index 1f28b3e..834ad43 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -123,12 +123,12 @@ struct dlm_lksb {
#ifndef MAP_DIR
#define MAP_DIR "/run/mdadm"
#endif /* MAP_DIR */
-/* MAP_FILE is what we name the map file we put in MAP_DIR, in case you
+/* FMAP_FILE is what we name the map file we put in MAP_DIR, in case you
* want something other than the default of "map"
*/
-#ifndef MAP_FILE
-#define MAP_FILE "map"
-#endif /* MAP_FILE */
+#ifndef FMAP_FILE
+#define FMAP_FILE "map"
+#endif /* FMAP_FILE */
/* MDMON_DIR is where pid and socket files used for communicating
* with mdmon normally live. Best is /var/run/mdadm as
* mdmon is needed at early boot then it needs to write there prior
--
2.40.1

131 changes: 131 additions & 0 deletions packages/mdadm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions packages/mdadm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "mdadm"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[lib]
path = "../packages.rs"

[package.metadata.build-package]
releases-url = "https://cdn.kernel.org/pub/linux/utils/raid/mdadm/"

[[package.metadata.build-package.external-files]]
url = "https://cdn.kernel.org/pub/linux/utils/raid/mdadm/mdadm-4.3.tar.xz"
sha512 = "e44977f2f80d2471cb313803a60c92dafe8282ac06bbbfd41ae90ca493c64a3da94db924538788d045fd7f0667333912dabedb0b070f9abf5c0540b32e0fa08f"

[build-dependencies]
glibc = { path = "../glibc" }
systemd = { path = "../systemd" }
49 changes: 49 additions & 0 deletions packages/mdadm/mdadm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Name: %{_cross_os}mdadm
Version: 4.3
Release: 1%{?dist}
Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
License: GPL-2.0-only
URL: https://cdn.kernel.org/pub/linux/utils/raid/mdadm/
Source0: https://cdn.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
BuildRequires: %{_cross_os}glibc-devel
BuildRequires: %{_cross_os}systemd-devel

# local patches
Patch0001: 0001-rename-MAP_FILE-FMAP_FILE-to-avoid-issue-with-MAP_FI.patch

%description
%{summary}.

%global debug_package %{nil}
%global set_env \
%set_cross_build_flags \\\
export CC=%{_cross_target}-gcc \\\
CFLAGS="%{_cross_cflags} -DNO_COROSYNC -DNO_DLM" \
LDFLAGS="%{_cross_ldflags}" \
%{nil}

%prep
%autosetup -n mdadm-%{version} -p1

%build
%set_env
make

%install
%set_env
make install-bin DESTDIR=%{buildroot}%{_cross_rootdir}/usr
make install-udev DESTDIR=%{buildroot}

%files
%license COPYING
%{_cross_attribution_file}
%{_cross_sbindir}/mdadm
%{_cross_sbindir}/mdmon
%{_cross_udevrulesdir}/01-md-raid-creating.rules
%{_cross_udevrulesdir}/63-md-raid-arrays.rules
%{_cross_udevrulesdir}/64-md-raid-assembly.rules
%{_cross_udevrulesdir}/69-md-clustered-confirm-device.rules

%changelog


Loading

0 comments on commit 9e468b2

Please sign in to comment.