sys-fs/mdadm: Import latest mdadm from Gentoo

This commit is contained in:
Krzesimir Nowak 2020-08-25 11:30:34 +02:00
parent b2ade58190
commit a3c88140ec
10 changed files with 227 additions and 0 deletions

View File

@ -0,0 +1,2 @@
DIST mdadm-4.1.tar.xz 440756 BLAKE2B df0506d937c2aa309d7c68804f66f7dcd51783288594bf746832311c64b8cf82004af4af5f246c5f9753f1de324ff7d49b5ee752d6a00ec03864f7885389706e SHA512 0859c5d3e786345d93ff2c3b291ca8866ba60f1375479e5b4d343124f6824140a8268d42b8ae603b069edba761aa30aaf20d49e9ec54dfcbad34bad3bea0e433
DIST mdadm_4.1-3.debian.tar.xz 89640 BLAKE2B 3cb5e42dcbd218a71e55127cecda6f2594a1b1691e17c05f52a8cd0ba05b556d2812772e53d78de025738d7c2de059df3f878b8290ba3906b3d75ef435bfb698 SHA512 e9b04abf195d7bda9fb0197eb926c01a69b879ef82c72af6497116cea9be8f0823408dddbe5c6c033f5fae554a8fec17299e361fa48045e033c87dcee1a0bb63

View File

@ -0,0 +1,9 @@
# Based on Debian /etc/default/mdadm
# Gentoo comment: The cronjob checks for this value to decide to actually
# validate arrays. If missing, it does NOT actually do anything.
# AUTOCHECK:
# should mdadm run periodic redundancy checks over your arrays? See
# /etc/cron.weekly/mdadm
#AUTOCHECK=true

View File

@ -0,0 +1,31 @@
https://bugs.gentoo.org/580188
From 5c97e465b33bf8fefb17da7f553a1c3812e508d5 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 19 Apr 2016 18:10:54 -0400
Subject: [PATCH] include sys/sysmacros.h for major/minor/makedev prototypes
These funcs are defined in sys/sysmacros.h, so include it for them.
It works today due to an implicit include by sys/types.h, but the
various Linux C libraries are moving away from that.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
mdadm.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/mdadm.h b/mdadm.h
index d209488..b8767a7 100755
--- a/mdadm.h
+++ b/mdadm.h
@@ -33,6 +33,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
# endif
#endif
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdint.h>
--
2.7.4

View File

@ -0,0 +1,7 @@
# /etc/conf.d/mdadm: config file for /etc/init.d/mdadm
# Misc options to pass to mdadm in monitor mode.
# For more info, run `mdadm --monitor --help` or see
# the mdadm(8) manpage.
MDADM_OPTS="--syslog"

View File

@ -0,0 +1,25 @@
#!/sbin/openrc-run
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
use logger dns net
}
start() {
ebegin "Starting mdadm monitor"
mdadm --monitor --scan \
--daemonise \
--pid-file /var/run/mdadm.pid \
${MDADM_OPTS}
eend $?
}
stop() {
local ret
ebegin "Stopping mdadm monitor"
start-stop-daemon --stop --pidfile /var/run/mdadm.pid
ret=$?
rm -f /var/run/mdadm.pid
eend ${ret}
}

View File

@ -0,0 +1,5 @@
#!/bin/sh
# This requires that AUTOCHECK is true in /etc/default/mdadm
if [ -x /usr/sbin/checkarray ] && [ $(date +\%d) -le 7 ]; then
/usr/sbin/checkarray --cron --all --idle --quiet
fi

View File

@ -0,0 +1,11 @@
# /etc/conf.d/mdraid: config file for /etc/init.d/mdraid
# For people who run raid on top of some other layer (like
# dmcrypt), use rc_need to specify that requirement. See
# the runscript(8) man page for more information.
# Most configuration happens in /etc/mdadm.conf.
# Pass additional options when assembling raids.
# Note: This applies to all raids.
MDADM_ASSEMBLE_OPTS=""

View File

@ -0,0 +1,39 @@
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
before checkfs fsck
after modules
}
start() {
local output
ebegin "Starting up RAID devices"
output=$(mdadm -As ${MDADM_ASSEMBLE_OPTS} 2>&1)
eend $? "${output}"
local pat="/dev/md_d*"
set -- ${pat}
if [ "$*" != "${pat}" ] ; then
ebegin "Creating RAID device partitions"
blockdev "$@"
eend $?
# wait because vgscan runs next, and we want udev to fire
sleep 1
fi
return 0
}
stop() {
local output
# XXX: Maybe drop this check ?
[ ! -e /etc/mdadm/mdadm.conf ] && [ ! -e /etc/mdadm.conf ] && return 0
ebegin "Shutting down RAID devices (mdadm)"
output=$(mdadm -Ss 2>&1)
eend $? "${output}"
}

View File

@ -0,0 +1,87 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit flag-o-matic multilib systemd toolchain-funcs udev
DESCRIPTION="Tool for running RAID systems - replacement for the raidtools"
HOMEPAGE="https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/"
DEB_PF="4.1-3"
SRC_URI="https://www.kernel.org/pub/linux/utils/raid/mdadm/${P/_/-}.tar.xz
mirror://debian/pool/main/m/mdadm/${PN}_${DEB_PF}.debian.tar.xz"
LICENSE="GPL-2"
SLOT="0"
[[ "${PV}" = *_rc* ]] || \
KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~mips ppc ppc64 sparc x86"
IUSE="static"
DEPEND="virtual/pkgconfig
app-arch/xz-utils"
RDEPEND=">=sys-apps/util-linux-2.16"
# The tests edit values in /proc and run tests on software raid devices.
# Thus, they shouldn't be run on systems with active software RAID devices.
RESTRICT="test"
PATCHES=(
"${FILESDIR}"/${PN}-3.4-sysmacros.patch #580188
)
mdadm_emake() {
# We should probably make corosync & libdlm into USE flags. #573782
emake \
PKG_CONFIG="$(tc-getPKG_CONFIG)" \
CC="$(tc-getCC)" \
CWFLAGS="-Wall" \
CXFLAGS="${CFLAGS}" \
UDEVDIR="$(get_udevdir)" \
SYSTEMD_DIR="$(systemd_get_systemunitdir)" \
COROSYNC="-DNO_COROSYNC" \
DLM="-DNO_DLM" \
"$@"
}
src_compile() {
use static && append-ldflags -static
mdadm_emake all
}
src_test() {
mdadm_emake test
sh ./test || die
}
src_install() {
mdadm_emake DESTDIR="${D}" install install-systemd
dodoc ChangeLog INSTALL TODO README* ANNOUNCE-*
insinto /etc
newins mdadm.conf-example mdadm.conf
newinitd "${FILESDIR}"/mdadm.rc mdadm
newconfd "${FILESDIR}"/mdadm.confd mdadm
newinitd "${FILESDIR}"/mdraid.rc mdraid
newconfd "${FILESDIR}"/mdraid.confd mdraid
# From the Debian patchset
into /usr
dodoc "${WORKDIR}"/debian/README.checkarray
dosbin "${WORKDIR}"/debian/checkarray
insinto /etc/default
newins "${FILESDIR}"/etc-default-mdadm mdadm
exeinto /etc/cron.weekly
newexe "${FILESDIR}"/mdadm.weekly mdadm
}
pkg_postinst() {
if ! systemd_is_booted; then
if [[ -z ${REPLACING_VERSIONS} ]] ; then
# Only inform people the first time they install.
elog "If you're not relying on kernel auto-detect of your RAID"
elog "devices, you need to add 'mdraid' to your 'boot' runlevel:"
elog " rc-update add mdraid boot"
fi
fi
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>base-system@gentoo.org</email>
<name>Gentoo Base System</name>
</maintainer>
<upstream>
<remote-id type="cpe">cpe:/a:mdadm_project:mdadm</remote-id>
</upstream>
</pkgmetadata>