Skip to content

Commit

Permalink
feat(mdadm): configure mdadm.conf path for use with extensionconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Rosenstein committed Jul 18, 2024
1 parent b48d3a6 commit 611ab9d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion storage/mdadm/files/udev-md-raid-arrays.rules
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TEST!="md/array_state", GOTO="md_end"
ATTR{md/array_state}=="clear*|inactive", GOTO="md_end"
LABEL="md_ignore_state"

IMPORT{program}="/usr/local/sbin/mdadm --detail --no-devices --export $devnode"
IMPORT{program}="/usr/local/sbin/mdadm --detail -c /var/run/mdadm/mdadm.conf --no-devices --export $devnode"
ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
Expand Down
2 changes: 1 addition & 1 deletion storage/mdadm/files/udev-md-raid-assembly.rules
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LABEL="md_inc"

# 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}="/usr/local/sbin/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
ACTION=="add|change", IMPORT{program}="/usr/local/sbin/mdadm --incremental -c /var/run/mdadm/mdadm.conf --export $devnode --offroot $env{DEVLINKS}"
ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/usr/local/sbin/mdadm -If $name --path $env{ID_PATH}"
ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/usr/local/sbin/mdadm -If $name"

Expand Down
11 changes: 11 additions & 0 deletions storage/mdadm/patches/change-sysconfdir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- mdadm.orig/Makefile
+++ mdadm/Makefile
@@ -89,7 +89,7 @@

PKG_CONFIG ?= pkg-config

-SYSCONFDIR = /etc
+SYSCONFDIR = /var/run/mdadm/
CONFFILE = $(SYSCONFDIR)/mdadm.conf
CONFFILE2 = $(SYSCONFDIR)/mdadm/mdadm.conf
MAILCMD =/usr/sbin/sendmail -t
3 changes: 3 additions & 0 deletions storage/mdadm/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ steps:
patch -p1 < /pkg/patches/no-werror.patch
patch -p1 < /pkg/patches/musl-125.patch
patch -p1 < /pkg/patches/exit-gracefully-when-md-device-not-found.patch
patch -p1 < /pkg/patches/change-sysconfdir.patch
build:
- |
mkdir -p /run/mdadm
Expand All @@ -35,6 +36,8 @@ steps:
cp mdmon /rootfs/usr/local/sbin/mdmon
cp /pkg/files/udev-md-raid-arrays.rules /rootfs/usr/etc/udev/rules.d/63-md-raid-arrays.rules
cp /pkg/files/udev-md-raid-assembly.rules /rootfs/usr/etc/udev/rules.d/64-md-raid-assembly.rules
mkdir /var/run/mdadm
touch /var/run/mdadm/mdadm.conf
test:
- |
mkdir -p /extensions-validator-rootfs
Expand Down

0 comments on commit 611ab9d

Please sign in to comment.