From 9ef1c0cb99928a9d49afcad85e4b5c280ec96622 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 27 May 2025 20:11:18 -0400 Subject: [PATCH] dracut: update to 107. - change the dracut-uefi hook to use the initramfs alternatives group. this also means we don't need the hacky `CREATE_UEFI_BUNDLES` variable fixes: #53300 - don't silence dracut output (match mkinitcpio's hook) --- srcpkgs/dracut/dracut-uefi.INSTALL.msg | 9 ++ srcpkgs/dracut/files/dracut-uefi-hook.confd | 9 +- srcpkgs/dracut/files/kernel-hook-postinst | 2 +- .../dracut/files/kernel-uefi-hook-postinst | 5 +- srcpkgs/dracut/patches/musl-1.1.patch | 97 ------------------- srcpkgs/dracut/template | 17 +++- 6 files changed, 27 insertions(+), 112 deletions(-) create mode 100644 srcpkgs/dracut/dracut-uefi.INSTALL.msg delete mode 100644 srcpkgs/dracut/patches/musl-1.1.patch diff --git a/srcpkgs/dracut/dracut-uefi.INSTALL.msg b/srcpkgs/dracut/dracut-uefi.INSTALL.msg new file mode 100644 index 00000000000..f7ca149d385 --- /dev/null +++ b/srcpkgs/dracut/dracut-uefi.INSTALL.msg @@ -0,0 +1,9 @@ +The dracut-uefi install and remove scripts are now controlled by the +initramfs alternative group. To use dracut-uefi to generate unified +kernel image initramfses, run: + + xbps-alternatives -s dracut-uefi + +Then (re)generate the UKIs with: + + xbps-reconfigure -f linux6.Y diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd index 5638da56f41..32aaf52e75c 100644 --- a/srcpkgs/dracut/files/dracut-uefi-hook.confd +++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd @@ -1,11 +1,10 @@ # Options for the dracut-uefi kernel hook script installed by the dracut package. -# To enable EFI bundle creation in dracut, uncomment -#CREATE_UEFI_BUNDLES=yes -# This requires an EFI stub, provided by the gummiboot package, -# as well as setting the kernel command line. -# Booting without a kernel command line is unsupported. +# To enable EFI bundle creation in dracut, set dracut-uefi +# as the initramfs alternative provider: +# xbps-alternatives -s dracut-uefi +# Setting the kernel command-line is required. # You can set the kernel command line with #KERNEL_CMDLINE="loglevel=4" # or by setting kernel_cmdline in a dracut.conf(5) file. diff --git a/srcpkgs/dracut/files/kernel-hook-postinst b/srcpkgs/dracut/files/kernel-hook-postinst index fe2072e986d..75a0f0d57cb 100644 --- a/srcpkgs/dracut/files/kernel-hook-postinst +++ b/srcpkgs/dracut/files/kernel-hook-postinst @@ -11,4 +11,4 @@ if [ ! -x usr/bin/dracut ]; then exit 0 fi -usr/bin/dracut -q --force boot/initramfs-${VERSION}.img ${VERSION} +usr/bin/dracut --force boot/initramfs-${VERSION}.img ${VERSION} diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst index 153db79eb0f..1021d961e43 100644 --- a/srcpkgs/dracut/files/kernel-uefi-hook-postinst +++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst @@ -8,9 +8,6 @@ PKGNAME="$1" VERSION="$2" . "${ROOTDIR}/etc/default/dracut-uefi-hook" -if [ -z "${CREATE_UEFI_BUNDLES}" ]; then - exit 0 -fi if [ ! -x usr/bin/dracut ]; then exit 0 @@ -18,6 +15,6 @@ fi mkdir -p ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void} -usr/bin/dracut -q --force ${DRACUT_OPTIONS} \ +usr/bin/dracut --force ${DRACUT_OPTIONS} \ ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} \ --uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION} diff --git a/srcpkgs/dracut/patches/musl-1.1.patch b/srcpkgs/dracut/patches/musl-1.1.patch deleted file mode 100644 index 2c73d1c5bf0..00000000000 --- a/srcpkgs/dracut/patches/musl-1.1.patch +++ /dev/null @@ -1,97 +0,0 @@ -From c52069f7a0adab4b5c5b911a44d65d3ba0989d7e Mon Sep 17 00:00:00 2001 -From: classabbyamp -Date: Sat, 12 Oct 2024 20:06:12 -0400 -Subject: [PATCH] Revert "perf(dracut-install): stat() w/unused buf -> - access(F_OK) in dracut-install" - -This reverts commit e7ed8337bb9fec0283af5dc745450394ba649a03. - -This commit broke compatibility with musl 1.1. ---- - src/install/dracut-install.c | 19 +++++++++++-------- - 1 file changed, 11 insertions(+), 8 deletions(-) - -diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c -index 96bc2eb6..30c51a30 100644 ---- a/src/install/dracut-install.c -+++ b/src/install/dracut-install.c -@@ -812,7 +812,7 @@ static int dracut_mkdir(const char *src) - - static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir, bool resolvedeps, bool hashdst) - { -- struct stat sb; -+ struct stat sb, db; - _cleanup_free_ char *fullsrcpath = NULL; - _cleanup_free_ char *fulldstpath = NULL; - _cleanup_free_ char *fulldstdir = NULL; -@@ -898,7 +898,7 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir - return 1; - } - -- ret = access(fulldstdir, F_OK); -+ ret = stat(fulldstdir, &db); - - if (ret < 0) { - _cleanup_free_ char *dname = NULL; -@@ -958,12 +958,12 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir - return 1; - } - -- if (faccessat(AT_FDCWD, abspath, F_OK, AT_SYMLINK_NOFOLLOW) != 0) { -+ if (lstat(abspath, &sb) != 0) { - log_debug("lstat '%s': %m", abspath); - return 1; - } - -- if (faccessat(AT_FDCWD, fulldstpath, F_OK, AT_SYMLINK_NOFOLLOW) != 0) { -+ if (lstat(fulldstpath, &sb) != 0) { - _cleanup_free_ char *absdestpath = NULL; - - _asprintf(&absdestpath, "%s/%s", destrootdir, -@@ -1313,6 +1313,7 @@ static char **find_binary(const char *src) - char *newsrc = NULL; - - STRV_FOREACH(q, pathdirs) { -+ struct stat sb; - char *fullsrcpath; - - _asprintf(&newsrc, "%s/%s", *q, src); -@@ -1325,8 +1326,8 @@ static char **find_binary(const char *src) - continue; - } - -- if (faccessat(AT_FDCWD, fullsrcpath, F_OK, AT_SYMLINK_NOFOLLOW) != 0) { -- log_debug("lstat(%s) != 0", fullsrcpath); -+ if (lstat(fullsrcpath, &sb) != 0) { -+ log_debug("stat(%s) != 0", fullsrcpath); - free(newsrc); - newsrc = NULL; - free(fullsrcpath); -@@ -1441,8 +1442,9 @@ static int install_firmware_fullpath(const char *fwpath) - { - const char *fw = fwpath; - _cleanup_free_ char *fwpath_compressed = NULL; -+ struct stat sb; - int ret; -- if (access(fwpath, F_OK) != 0) { -+ if (stat(fwpath, &sb) != 0) { - _asprintf(&fwpath_compressed, "%s.zst", fwpath); - if (access(fwpath_compressed, F_OK) != 0) { - strcpy(fwpath_compressed + strlen(fwpath) + 1, "xz"); -@@ -1485,11 +1487,12 @@ static int install_firmware(struct kmod_module *mod) - ret = -1; - STRV_FOREACH(q, firmwaredirs) { - _cleanup_free_ char *fwpath = NULL; -+ struct stat sb; - - _asprintf(&fwpath, "%s/%s", *q, value); - - if (strpbrk(value, "*?[") != NULL -- && access(fwpath, F_OK) != 0) { -+ && stat(fwpath, &sb) != 0) { - size_t i; - _cleanup_globfree_ glob_t globbuf; - --- -2.46.0 - diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template index 15e5605d2c4..d6288079ae2 100644 --- a/srcpkgs/dracut/template +++ b/srcpkgs/dracut/template @@ -1,7 +1,7 @@ # Template file for 'dracut' pkgname=dracut -version=106 -revision=2 +version=107 +revision=1 build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc" conf_files="/etc/dracut.conf" @@ -14,7 +14,7 @@ license="GPL-2.0-or-later, LGPL-2.0-or-later" homepage="https://github.com/dracut-ng/dracut-ng/wiki" changelog="https://raw.githubusercontent.com/dracut-ng/dracut-ng/master/NEWS.md" distfiles="https://github.com/dracut-ng/dracut-ng/archive/refs/tags/${version}.tar.gz" -checksum=9009ac13072c9b583822ad1a17f2cca47af463190f0d6623e90b0f1107c71f95 +checksum=b39d0d1cd35ff43aba8771c5367d8c6c59bb432c0cac62f49601f21c0d634895 alternatives=" initramfs:/etc/kernel.d/post-install/20-initramfs:/usr/libexec/dracut/kernel-hook-postinst initramfs:/etc/kernel.d/post-remove/20-initramfs:/usr/libexec/dracut/kernel-hook-postrm @@ -51,6 +51,9 @@ post_install() { rm ${DESTDIR}/usr/share/man/man8/*.service.* rm -r ${DESTDIR}/usr/lib/kernel rm -r "${DESTDIR}"/usr/lib/dracut/test + rm -r "${DESTDIR}"/usr/lib/dracut/dracut.conf.d/test* + rm -r "${DESTDIR}"/usr/lib/dracut/modules.d/80test* + } dracut-network_package() { @@ -69,10 +72,14 @@ dracut-uefi_package() { depends="binutils systemd-boot-efistub ${sourcepkg}>=${version}_${revision}" short_desc+=" - UEFI bundle hook" conf_files="/etc/default/dracut-uefi-hook" + alternatives=" + initramfs:/etc/kernel.d/post-install/20-initramfs:/usr/libexec/dracut/uefi-hook-postinst + initramfs:/etc/kernel.d/post-remove/20-initramfs:/usr/libexec/dracut/uefi-hook-postrm + " pkg_install() { vinstall ${FILESDIR}/dracut-uefi-hook.confd 644 etc/default dracut-uefi-hook - vinstall ${FILESDIR}/kernel-uefi-hook-postinst 755 etc/kernel.d/post-install 20-dracut-uefi - vinstall ${FILESDIR}/kernel-uefi-hook-postrm 755 etc/kernel.d/post-remove 20-dracut-uefi + vinstall ${FILESDIR}/kernel-uefi-hook-postinst 755 usr/libexec/dracut uefi-hook-postinst + vinstall ${FILESDIR}/kernel-uefi-hook-postrm 755 usr/libexec/dracut uefi-hook-postrm } }