diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/Manifest new file mode 100644 index 0000000000..7ee62a3b9b --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/Manifest @@ -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 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/etc-default-mdadm b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/etc-default-mdadm new file mode 100644 index 0000000000..921c70b194 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/etc-default-mdadm @@ -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 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm-3.4-sysmacros.patch b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm-3.4-sysmacros.patch new file mode 100644 index 0000000000..22a3934476 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm-3.4-sysmacros.patch @@ -0,0 +1,31 @@ +https://bugs.gentoo.org/580188 + +From 5c97e465b33bf8fefb17da7f553a1c3812e508d5 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +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 +--- + 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 + #include + #include + #include +-- +2.7.4 + diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.confd b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.confd new file mode 100644 index 0000000000..a4ead14dc3 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.confd @@ -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" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.rc b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.rc new file mode 100644 index 0000000000..c5bd38b13a --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.rc @@ -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} +} diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.weekly b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.weekly new file mode 100644 index 0000000000..e2b35b550f --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdadm.weekly @@ -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 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdraid.confd b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdraid.confd new file mode 100644 index 0000000000..5694d732d0 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdraid.confd @@ -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="" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdraid.rc b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdraid.rc new file mode 100644 index 0000000000..a30035dbbb --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/files/mdraid.rc @@ -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}" +} diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/mdadm-4.1.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/mdadm-4.1.ebuild new file mode 100644 index 0000000000..515775501e --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/mdadm-4.1.ebuild @@ -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 +} diff --git a/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/metadata.xml b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/metadata.xml new file mode 100644 index 0000000000..6923416f0f --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-fs/mdadm/metadata.xml @@ -0,0 +1,11 @@ + + + + + base-system@gentoo.org + Gentoo Base System + + + cpe:/a:mdadm_project:mdadm + +