From 424622be997f05931f976120538a673c84cb1a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20F=C3=B6rster?= Date: Tue, 15 Mar 2022 21:23:04 +0100 Subject: [PATCH] [sys-kernel/dracut] bump, with rusty bits --- sys-kernel/dracut/Manifest | 1 + sys-kernel/dracut/dracut-056.ebuild | 173 ++++++++++++++++++ sys-kernel/dracut/dracut-9999.ebuild | 171 +++++++++++++++++ sys-kernel/dracut/files/056-musl.patch | 33 ++++ sys-kernel/dracut/files/056-sysctl-vars.patch | 39 ++++ .../files/gentoo-ldconfig-paths-r1.patch | 39 ++++ sys-kernel/dracut/metadata.xml | 16 ++ 7 files changed, 472 insertions(+) create mode 100644 sys-kernel/dracut/Manifest create mode 100644 sys-kernel/dracut/dracut-056.ebuild create mode 100644 sys-kernel/dracut/dracut-9999.ebuild create mode 100644 sys-kernel/dracut/files/056-musl.patch create mode 100644 sys-kernel/dracut/files/056-sysctl-vars.patch create mode 100644 sys-kernel/dracut/files/gentoo-ldconfig-paths-r1.patch create mode 100644 sys-kernel/dracut/metadata.xml diff --git a/sys-kernel/dracut/Manifest b/sys-kernel/dracut/Manifest new file mode 100644 index 0000000..13b4cf9 --- /dev/null +++ b/sys-kernel/dracut/Manifest @@ -0,0 +1 @@ +DIST dracut-056.tar.xz 384196 BLAKE2B e3e4fa3024b401cc954ba6069c54e95912691ff68a838e3c43bfc6a5b284bdee1669c782b30503c0246b7146c545ee8825febefcff93bae76ec46067cb7b87e1 SHA512 19268763e128984d20cab766bbdf2de12fe534ce2562fc688203099ef9b4cf83d0ccd2129499c70cdc6dd4ad53f0ffc2f3378eff5b8a15fda27c23b20f903df2 diff --git a/sys-kernel/dracut/dracut-056.ebuild b/sys-kernel/dracut/dracut-056.ebuild new file mode 100644 index 0000000..0544747 --- /dev/null +++ b/sys-kernel/dracut/dracut-056.ebuild @@ -0,0 +1,173 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +CARGO_OPTIONAL=1 + +inherit bash-completion-r1 cargo linux-info optfeature systemd toolchain-funcs + +if [[ ${PV} == 9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/dracutdevs/dracut" +else + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" + SRC_URI="https://www.kernel.org/pub/linux/utils/boot/${PN}/${P}.tar.xz" +fi + +DESCRIPTION="Generic initramfs generation tool" +HOMEPAGE="https://dracut.wiki.kernel.org" + +LICENSE="GPL-2" +SLOT="0" +IUSE="dracut-cpio selinux test" + +RESTRICT="!test? ( test )" + +RDEPEND=" + app-arch/cpio + >=app-shells/bash-4.0:0 + sys-apps/coreutils[xattr(-)] + >=sys-apps/kmod-23[tools] + || ( + >=sys-apps/sysvinit-2.87-r3 + sys-apps/openrc[sysv-utils(-),selinux?] + sys-apps/systemd[sysv-utils] + ) + >=sys-apps/util-linux-2.21 + virtual/pkgconfig + virtual/udev + + elibc_musl? ( sys-libs/fts-standalone ) + selinux? ( + sec-policy/selinux-dracut + sys-libs/libselinux + sys-libs/libsepol + ) +" +DEPEND=" + >=sys-apps/kmod-23 + elibc_musl? ( sys-libs/fts-standalone ) +" + +BDEPEND=" + app-text/asciidoc + app-text/docbook-xml-dtd:4.5 + >=app-text/docbook-xsl-stylesheets-1.75.2 + >=dev-libs/libxslt-1.1.26 + virtual/pkgconfig + dracut-cpio? ( virtual/rust ) +" + +QA_MULTILIB_PATHS="usr/lib/dracut/.*" + +PATCHES=( + "${FILESDIR}"/056-sysctl-vars.patch + "${FILESDIR}"/056-musl.patch + "${FILESDIR}"/gentoo-ldconfig-paths-r1.patch +) + +src_configure() { + local myconf=( + --prefix="${EPREFIX}/usr" + --sysconfdir="${EPREFIX}/etc" + --bashcompletiondir="$(get_bashcompdir)" + --systemdsystemunitdir="$(systemd_get_systemunitdir)" + $(use_enable dracut-cpio) + ) + + tc-export CC PKG_CONFIG + + echo ./configure "${myconf[@]}" + ./configure "${myconf[@]}" || die +} + +src_test() { + if [[ ${EUID} != 0 ]]; then + # Tests need root privileges, bug #298014 + ewarn "Skipping tests: Not running as root." + elif [[ ! -w /dev/kvm ]]; then + ewarn "Skipping tests: Unable to access /dev/kvm." + else + emake -C test check + fi +} + +src_install() { + local DOCS=( + AUTHORS + NEWS.md + README.md + docs/README.cross + docs/README.generic + docs/README.kernel + docs/SECURITY.md + ) + + default + + docinto html + dodoc dracut.html +} + +pkg_postinst() { + if linux-info_get_any_version && linux_config_exists; then + ewarn "" + ewarn "If the following test report contains a missing kernel" + ewarn "configuration option, you should reconfigure and rebuild your" + ewarn "kernel before booting image generated with this Dracut version." + ewarn "" + + local CONFIG_CHECK="~BLK_DEV_INITRD ~DEVTMPFS" + + # Kernel configuration options descriptions: + local ERROR_DEVTMPFS='CONFIG_DEVTMPFS: "Maintain a devtmpfs filesystem to mount at /dev" ' + ERROR_DEVTMPFS+='is missing and REQUIRED' + local ERROR_BLK_DEV_INITRD='CONFIG_BLK_DEV_INITRD: "Initial RAM filesystem and RAM disk ' + ERROR_BLK_DEV_INITRD+='(initramfs/initrd) support" is missing and REQUIRED' + + check_extra_config + echo + else + ewarn "" + ewarn "Your kernel configuration couldn't be checked." + ewarn "Please check manually if following options are enabled:" + ewarn "" + ewarn " CONFIG_BLK_DEV_INITRD" + ewarn " CONFIG_DEVTMPFS" + ewarn "" + fi + + optfeature "Networking support" net-misc/networkmanager + optfeature "Legacy networking support" net-misc/curl "net-misc/dhcp[client]" \ + sys-apps/iproute2 "net-misc/iputils[arping]" + optfeature \ + "Measure performance of the boot process for later visualisation" \ + app-benchmarks/bootchart2 app-admin/killproc sys-process/acct + optfeature "Scan for Btrfs on block devices" sys-fs/btrfs-progs + optfeature "Load kernel modules and drop this privilege for real init" \ + sys-libs/libcap + optfeature "Support CIFS" net-fs/cifs-utils + optfeature "Decrypt devices encrypted with cryptsetup/LUKS" \ + "sys-fs/cryptsetup[-static-libs]" + optfeature "Support for GPG-encrypted keys for crypt module" \ + app-crypt/gnupg + optfeature \ + "Allows use of dash instead of default bash (on your own risk)" \ + app-shells/dash + optfeature "Support iSCSI" sys-block/open-iscsi + optfeature "Support Logical Volume Manager" sys-fs/lvm2 + optfeature "Support MD devices, also known as software RAID devices" \ + sys-fs/mdadm + optfeature "Support Device Mapper multipathing" sys-fs/multipath-tools + optfeature "Plymouth boot splash" '>=sys-boot/plymouth-0.8.5-r5' + optfeature "Support network block devices" sys-block/nbd + optfeature "Support NFS" net-fs/nfs-utils net-nds/rpcbind + optfeature \ + "Install ssh and scp along with config files and specified keys" \ + net-misc/openssh + optfeature "Enable logging with rsyslog" app-admin/rsyslog + optfeature \ + "Enable rngd service to help generating entropy early during boot" \ + sys-apps/rng-tools +} diff --git a/sys-kernel/dracut/dracut-9999.ebuild b/sys-kernel/dracut/dracut-9999.ebuild new file mode 100644 index 0000000..f73c8ed --- /dev/null +++ b/sys-kernel/dracut/dracut-9999.ebuild @@ -0,0 +1,171 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +CARGO_OPTIONAL=1 + +inherit bash-completion-r1 cargo linux-info optfeature systemd toolchain-funcs + +if [[ ${PV} == 9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/dracutdevs/dracut" +else + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" + SRC_URI="https://www.kernel.org/pub/linux/utils/boot/${PN}/${P}.tar.xz" +fi + +DESCRIPTION="Generic initramfs generation tool" +HOMEPAGE="https://dracut.wiki.kernel.org" + +LICENSE="GPL-2" +SLOT="0" +IUSE="dracut-cpio selinux test" + +RESTRICT="!test? ( test )" + +RDEPEND=" + app-arch/cpio + >=app-shells/bash-4.0:0 + sys-apps/coreutils[xattr(-)] + >=sys-apps/kmod-23[tools] + || ( + >=sys-apps/sysvinit-2.87-r3 + sys-apps/openrc[sysv-utils(-),selinux?] + sys-apps/systemd[sysv-utils] + ) + >=sys-apps/util-linux-2.21 + virtual/pkgconfig + virtual/udev + + elibc_musl? ( sys-libs/fts-standalone ) + selinux? ( + sec-policy/selinux-dracut + sys-libs/libselinux + sys-libs/libsepol + ) +" +DEPEND=" + >=sys-apps/kmod-23 + elibc_musl? ( sys-libs/fts-standalone ) +" + +BDEPEND=" + app-text/asciidoc + app-text/docbook-xml-dtd:4.5 + >=app-text/docbook-xsl-stylesheets-1.75.2 + >=dev-libs/libxslt-1.1.26 + virtual/pkgconfig + dracut-cpio? ( virtual/rust ) +" + +QA_MULTILIB_PATHS="usr/lib/dracut/.*" + +PATCHES=( + "${FILESDIR}"/gentoo-ldconfig-paths-r1.patch +) + +src_configure() { + local myconf=( + --prefix="${EPREFIX}/usr" + --sysconfdir="${EPREFIX}/etc" + --bashcompletiondir="$(get_bashcompdir)" + --systemdsystemunitdir="$(systemd_get_systemunitdir)" + $(use_enable dracut-cpio) + ) + + tc-export CC PKG_CONFIG + + echo ./configure "${myconf[@]}" + ./configure "${myconf[@]}" || die +} + +src_test() { + if [[ ${EUID} != 0 ]]; then + # Tests need root privileges, bug #298014 + ewarn "Skipping tests: Not running as root." + elif [[ ! -w /dev/kvm ]]; then + ewarn "Skipping tests: Unable to access /dev/kvm." + else + emake -C test check + fi +} + +src_install() { + local DOCS=( + AUTHORS + NEWS.md + README.md + docs/README.cross + docs/README.generic + docs/README.kernel + docs/SECURITY.md + ) + + default + + docinto html + dodoc dracut.html +} + +pkg_postinst() { + if linux-info_get_any_version && linux_config_exists; then + ewarn "" + ewarn "If the following test report contains a missing kernel" + ewarn "configuration option, you should reconfigure and rebuild your" + ewarn "kernel before booting image generated with this Dracut version." + ewarn "" + + local CONFIG_CHECK="~BLK_DEV_INITRD ~DEVTMPFS" + + # Kernel configuration options descriptions: + local ERROR_DEVTMPFS='CONFIG_DEVTMPFS: "Maintain a devtmpfs filesystem to mount at /dev" ' + ERROR_DEVTMPFS+='is missing and REQUIRED' + local ERROR_BLK_DEV_INITRD='CONFIG_BLK_DEV_INITRD: "Initial RAM filesystem and RAM disk ' + ERROR_BLK_DEV_INITRD+='(initramfs/initrd) support" is missing and REQUIRED' + + check_extra_config + echo + else + ewarn "" + ewarn "Your kernel configuration couldn't be checked." + ewarn "Please check manually if following options are enabled:" + ewarn "" + ewarn " CONFIG_BLK_DEV_INITRD" + ewarn " CONFIG_DEVTMPFS" + ewarn "" + fi + + optfeature "Networking support" net-misc/networkmanager + optfeature "Legacy networking support" net-misc/curl "net-misc/dhcp[client]" \ + sys-apps/iproute2 "net-misc/iputils[arping]" + optfeature \ + "Measure performance of the boot process for later visualisation" \ + app-benchmarks/bootchart2 app-admin/killproc sys-process/acct + optfeature "Scan for Btrfs on block devices" sys-fs/btrfs-progs + optfeature "Load kernel modules and drop this privilege for real init" \ + sys-libs/libcap + optfeature "Support CIFS" net-fs/cifs-utils + optfeature "Decrypt devices encrypted with cryptsetup/LUKS" \ + "sys-fs/cryptsetup[-static-libs]" + optfeature "Support for GPG-encrypted keys for crypt module" \ + app-crypt/gnupg + optfeature \ + "Allows use of dash instead of default bash (on your own risk)" \ + app-shells/dash + optfeature "Support iSCSI" sys-block/open-iscsi + optfeature "Support Logical Volume Manager" sys-fs/lvm2 + optfeature "Support MD devices, also known as software RAID devices" \ + sys-fs/mdadm + optfeature "Support Device Mapper multipathing" sys-fs/multipath-tools + optfeature "Plymouth boot splash" '>=sys-boot/plymouth-0.8.5-r5' + optfeature "Support network block devices" sys-block/nbd + optfeature "Support NFS" net-fs/nfs-utils net-nds/rpcbind + optfeature \ + "Install ssh and scp along with config files and specified keys" \ + net-misc/openssh + optfeature "Enable logging with rsyslog" app-admin/rsyslog + optfeature \ + "Enable rngd service to help generating entropy early during boot" \ + sys-apps/rng-tools +} diff --git a/sys-kernel/dracut/files/056-musl.patch b/sys-kernel/dracut/files/056-musl.patch new file mode 100644 index 0000000..ded1888 --- /dev/null +++ b/sys-kernel/dracut/files/056-musl.patch @@ -0,0 +1,33 @@ +From ce55a85ed5d902c19d75895508856f96ec2ceb1a Mon Sep 17 00:00:00 2001 +From: Laszlo Gombos +Date: Sun, 20 Feb 2022 22:23:49 -0500 +Subject: [PATCH] fix(install): restore musl support + +__GLIBC_PREREQ is only defined in glibc. +--- + src/install/util.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/install/util.c b/src/install/util.c +index 5721de89e..0af387c27 100644 +--- a/src/install/util.c ++++ b/src/install/util.c +@@ -24,17 +24,15 @@ + #include + #include + #include ++#include + + #include "util.h" + +-#if __GLIBC_PREREQ(2, 30) == 0 +-#include + #ifndef SYS_gettid + #error "SYS_gettid unavailable on this system" + #endif + + #define gettid() ((pid_t) syscall(SYS_gettid)) +-#endif /*__GLIBC_PREREQ */ + + size_t page_size(void) + { diff --git a/sys-kernel/dracut/files/056-sysctl-vars.patch b/sys-kernel/dracut/files/056-sysctl-vars.patch new file mode 100644 index 0000000..8b50eaa --- /dev/null +++ b/sys-kernel/dracut/files/056-sysctl-vars.patch @@ -0,0 +1,39 @@ +From 4c355d05587b0432a6dc551b8693dbdc51a07962 Mon Sep 17 00:00:00 2001 +From: Antonio Alvarez Feijoo +Date: Thu, 24 Feb 2022 09:36:02 +0100 +Subject: [PATCH] fix(dracut.sh): error exporting sysctl variables + +- Typo assigning depmodd and depmodconfdir. +- Typo exporting a variable called sysctl instead of sysctld. +--- + dracut.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index 0a3f59741..afc6fd04c 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1798,12 +1798,12 @@ fi + [[ -d $dracutsysrootdir$tmpfilesconfdir ]] || tmpfilesconfdir=/etc/tmpfiles.d + + [[ -d $dracutsysrootdir$depmodd ]] \ +- || sysctld=$(pkg-config libkmod --variable=depmodd 2> /dev/null) ++ || depmodd=$(pkg-config libkmod --variable=depmodd 2> /dev/null) + + [[ -d $dracutsysrootdir$depmodd ]] || depmodd=/usr/lib/depmod.d + + [[ -d $dracutsysrootdir$depmodconfdir ]] \ +- || sysctlconfdir=$(pkg-config libkmod --variable=depmodconfdir 2> /dev/null) ++ || depmodconfdir=$(pkg-config libkmod --variable=depmodconfdir 2> /dev/null) + + [[ -d $dracutsysrootdir$depmodconfdir ]] || depmodconfdir=/etc/depmod.d + +@@ -1820,7 +1820,7 @@ export initdir dracutbasedir \ + dbusinterfacesconfdir dbusservices dbusservicesconfdir dbussession \ + dbussessionconfdir dbussystem dbussystemconfdir dbussystemservices \ + dbussystemservicesconfdir environment environmentconfdir modulesload \ +- modulesloadconfdir sysctl sysctlconfdir sysusers sysusersconfdir \ ++ modulesloadconfdir sysctld sysctlconfdir sysusers sysusersconfdir \ + systemdutildir systemdutilconfdir systemdcatalog systemdntpunits \ + systemdntpunitsconfdir systemdsystemunitdir systemdsystemconfdir \ + hostonly_cmdline loginstall tmpfilesdir tmpfilesconfdir depmodd \ diff --git a/sys-kernel/dracut/files/gentoo-ldconfig-paths-r1.patch b/sys-kernel/dracut/files/gentoo-ldconfig-paths-r1.patch new file mode 100644 index 0000000..53349a1 --- /dev/null +++ b/sys-kernel/dracut/files/gentoo-ldconfig-paths-r1.patch @@ -0,0 +1,39 @@ +From e6a5f02038954ede223cc75901386acf43ec4264 Mon Sep 17 00:00:00 2001 +From: Alexander Tsoy +Date: Mon, 9 Mar 2020 02:47:07 +0300 +Subject: [PATCH] Remove redundant gcc paths in ldconfig_paths() + +Bug: https://bugs.gentoo.org/705728 +--- + dracut-functions.sh | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 5206bd21..a119fb15 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -81,7 +81,20 @@ find_binary() { + } + + ldconfig_paths() { +- $DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2> /dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq ++ local gccpath ++ ++ if type -P gcc-config &>/dev/null; then ++ gccpath=$(gcc-config -c) ++ gccpath=/usr/lib/gcc/${gccpath%-*}/${gccpath##*-} ++ fi ++ ++ while read -r line; do ++ if [[ ${line} != /usr/lib/gcc/* || -z ${gccpath} ]]; then ++ echo ${line} ++ elif [[ ${line} == ${gccpath} ]]; then ++ echo ${line} ++ fi ++ done < <($DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq) + } + + # Version comparision function. Assumes Linux style version scheme. +-- +2.32.0 + diff --git a/sys-kernel/dracut/metadata.xml b/sys-kernel/dracut/metadata.xml new file mode 100644 index 0000000..9f7e1ef --- /dev/null +++ b/sys-kernel/dracut/metadata.xml @@ -0,0 +1,16 @@ + + + + + chutzpah@gentoo.org + Patrick McLean + + + alexander@tsoy.me + Alexander Tsoy + + + floppym@gentoo.org + Mike Gilbert + +