From: Martin Wilck Date: Tue, 4 Nov 2025 16:03:23 +0000 (+0100) Subject: Makefile: install mdcheck and make its path configurable X-Git-Tag: mdadm-4.5~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=934d81184880d2231b0d7b3836b12358516ea35c;p=thirdparty%2Fmdadm.git Makefile: install mdcheck and make its path configurable The mdcheck script is called by the systemd units, but it is currently not installed. Fix it, using the make variable MISCDIR as target directory for the installation of mdcheck (defaults to current location /usr/share/mdadm). Also, make sure that mdcheck calls the mdadm executable that we installed. Signed-off-by: Martin Wilck --- diff --git a/Makefile b/Makefile index 387e4a56..fa114f31 100644 --- a/Makefile +++ b/Makefile @@ -162,6 +162,7 @@ MANDIR = /usr/share/man MAN4DIR = $(MANDIR)/man4 MAN5DIR = $(MANDIR)/man5 MAN8DIR = $(MANDIR)/man8 +MISCDIR = /usr/share/mdadm UDEVDIR := $(shell $(PKG_CONFIG) --variable=udevdir udev 2>/dev/null) ifndef UDEVDIR @@ -302,7 +303,7 @@ install-systemd: systemd/mdmon@.service mdcheck_continue.timer mdcheck_continue.service \ mdmonitor-oneshot.timer mdmonitor-oneshot.service \ ; \ - do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > .install.tmp.2 && \ + do sed -e 's,BINDIR,$(BINDIR),g;s,MISCDIR,$(MISCDIR),g' systemd/$$file > .install.tmp.2 && \ $(ECHO) $(INSTALL) -D -m 644 systemd/$$file $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \ $(INSTALL) -D -m 644 .install.tmp.2 $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \ rm -f .install.tmp.2; \ @@ -313,6 +314,12 @@ install-systemd: systemd/mdmon@.service $(INSTALL) -D -m 755 .install.tmp.3 $(DESTDIR)$(SYSTEMD_DIR)-shutdown/$$file ; \ rm -f .install.tmp.3; \ done + @for file in mdcheck ; \ + do sed -e 's,BINDIR,$(BINDIR),g' misc/$$file > .install.tmp.4 && \ + $(ECHO) $(INSTALL) -D -m 755 misc/$$file $(DESTDIR)$(MISCDIR)/$$file ; \ + $(INSTALL) -D -m 755 .install.tmp.4 $(DESTDIR)$(MISCDIR)/$$file ; \ + rm -f .install.tmp.4; \ + done install-bin: mdadm mdmon $(INSTALL) -D $(STRIP) -m 755 mdadm $(DESTDIR)$(BINDIR)/mdadm diff --git a/misc/mdcheck b/misc/mdcheck index 13d4a11a..e4f8fe2d 100644 --- a/misc/mdcheck +++ b/misc/mdcheck @@ -181,7 +181,7 @@ do sys=${sync_act%/md/*} dev=$(devname "$sys") || continue - mdadm --detail --export "$dev" | grep '^MD_UUID=' > $tmp || continue + BINDIR/mdadm --detail --export "$dev" | grep '^MD_UUID=' > $tmp || continue source $tmp [[ "$MD_UUID" ]] || continue diff --git a/systemd/mdcheck_continue.service b/systemd/mdcheck_continue.service index 6ea2bc1e..325bf2ae 100644 --- a/systemd/mdcheck_continue.service +++ b/systemd/mdcheck_continue.service @@ -14,4 +14,4 @@ Type=simple Environment="MDADM_CHECK_DURATION=6 hours" # mdcheck --start will continues previously started checks, and starts from # zero for arrays without a "Checked_$UUID" marker in /var/lib/mdcheck -ExecStart=/usr/share/mdadm/mdcheck --start --duration ${MDADM_CHECK_DURATION} +ExecStart=MISCDIR/mdcheck --start --duration ${MDADM_CHECK_DURATION} diff --git a/systemd/mdcheck_start.service b/systemd/mdcheck_start.service index c7ddd4f6..40e12299 100644 --- a/systemd/mdcheck_start.service +++ b/systemd/mdcheck_start.service @@ -12,4 +12,4 @@ Documentation=man:mdadm(8) [Service] Type=simple -ExecStart=/usr/share/mdadm/mdcheck --restart +ExecStart=MISCDIR/mdcheck --restart