Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] dracut: add EFI kernel hook
@ 2020-06-01  0:41 ericonr
  2020-06-01  0:47 ` [PR PATCH] [Updated] " ericonr
                   ` (62 more replies)
  0 siblings, 63 replies; 64+ messages in thread
From: ericonr @ 2020-06-01  0:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

There is a new pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 4491 bytes --]

From 79694d3bd265df1f0767c730990e9a8f3ecaa3a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook

Also made some small formatting changes.
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 11 ++++++++++
 .../dracut/files/kernel-uefi-hook-postinst    | 22 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 18 +++++++++++++++
 srcpkgs/dracut/template                       | 14 +++++++-----
 4 files changed, 60 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..32c34d8f14e
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,11 @@
+# Options for the dracut-uefi kernel hook script installed by the dracut package.
+
+CREATE_UEFI_BUNDLES=0
+# To allow efibootmgr to modify boot entries, set
+# CREATE_UEFI_BUNDLES=1
+
+# Output path for the EFI bundle
+UEFI_BUNDLE_PATH="/boot/efi/EFI/Void/linux-${VERSION}.efi"
+
+# Command line options for the dracut command
+# OPTIONS=
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..aba62dfb65c
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+OPTIONS="${OPTIONS} --force --uefi ${UEFI_BUNDLE_PATH} ${VERSION}"
+
+dracut ${OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..33a63367a04
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ -f "${UEFI_BUNDLE_PATH}" ]; then
+	rm -fv "${UEFI_BUNDLE_PATH}"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..407e55564f4 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,10 +1,10 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
-conf_files="/etc/dracut.conf"
+conf_files="/etc/dracut.conf /etc/default/dracut-uefi-hook"
 hostmakedepends="asciidoc pkg-config"
 makedepends="libkmod-devel"
 depends="bash coreutils cpio eudev gzip kmod>=3.7 kpartx util-linux"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -40,6 +40,10 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+	# EFI bundle config and hooks
+	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
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +56,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
@ 2020-06-01  0:47 ` ericonr
  2020-06-01  1:06 ` ericonr
                   ` (61 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-06-01  0:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 4558 bytes --]

From a13e6db5a4f6ff4d538424018d5fad4eca8152db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook

Also made some small formatting changes.
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 12 ++++++++++
 .../dracut/files/kernel-uefi-hook-postinst    | 22 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 18 +++++++++++++++
 srcpkgs/dracut/template                       | 14 +++++++-----
 4 files changed, 61 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..bbc9fded1b3
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,12 @@
+# Options for the dracut-uefi kernel hook script installed by the dracut package.
+
+CREATE_UEFI_BUNDLES=0
+# To allow dracut to create EFI bundles, set
+# CREATE_UEFI_BUNDLES=1
+# This requires an EFI stub, usually provided by the gummiboot package
+
+# Output path for the EFI bundle
+UEFI_BUNDLE_PATH="/boot/efi/EFI/Void/linux-${VERSION}.efi"
+
+# Command line options for the dracut command
+# OPTIONS=
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..aba62dfb65c
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+OPTIONS="${OPTIONS} --force --uefi ${UEFI_BUNDLE_PATH} ${VERSION}"
+
+dracut ${OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..33a63367a04
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ -f "${UEFI_BUNDLE_PATH}" ]; then
+	rm -fv "${UEFI_BUNDLE_PATH}"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..407e55564f4 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,10 +1,10 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
-conf_files="/etc/dracut.conf"
+conf_files="/etc/dracut.conf /etc/default/dracut-uefi-hook"
 hostmakedepends="asciidoc pkg-config"
 makedepends="libkmod-devel"
 depends="bash coreutils cpio eudev gzip kmod>=3.7 kpartx util-linux"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -40,6 +40,10 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+	# EFI bundle config and hooks
+	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
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +56,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
  2020-06-01  0:47 ` [PR PATCH] [Updated] " ericonr
@ 2020-06-01  1:06 ` ericonr
  2020-06-01  2:59 ` ericonr
                   ` (60 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-06-01  1:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 4691 bytes --]

From 64fd509912f3443e976731dbfa7c93ddcca8278f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook

Also made some small formatting changes.
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 12 ++++++++++
 .../dracut/files/kernel-uefi-hook-postinst    | 22 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 18 +++++++++++++++
 srcpkgs/dracut/template                       | 20 ++++++++++++-----
 4 files changed, 67 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..26c76eda74f
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,12 @@
+# Options for the dracut-uefi kernel hook script installed by the dracut package.
+
+CREATE_UEFI_BUNDLES=0
+# To allow dracut to create EFI bundles, set
+# CREATE_UEFI_BUNDLES=1
+# This requires an EFI stub, usually provided by the gummiboot package
+
+# Output directory for the EFI bundle
+UEFI_BUNDLE_DIR="/boot/efi/EFI/Void/"
+
+# Command line options for the dracut command
+# OPTIONS=
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..8138ca051ee
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+OPTIONS="${OPTIONS} --force --uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}"
+
+dracut ${OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..c6c7849ea09
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..55fdf8390f4 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,10 +1,10 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
-conf_files="/etc/dracut.conf"
+conf_files="/etc/dracut.conf /etc/default/dracut-uefi-hook"
 hostmakedepends="asciidoc pkg-config"
 makedepends="libkmod-devel"
 depends="bash coreutils cpio eudev gzip kmod>=3.7 kpartx util-linux"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -40,6 +40,16 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	# EFI bundle config and hooks
+	case "$XBPS_TARGET_MACHINE" in
+		i686*|x86_64*|aarch64*)
+			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
+			;;
+	esac
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +62,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
  2020-06-01  0:47 ` [PR PATCH] [Updated] " ericonr
  2020-06-01  1:06 ` ericonr
@ 2020-06-01  2:59 ` ericonr
  2020-06-01  3:57 ` ericonr
                   ` (59 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-06-01  2:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5271 bytes --]

From 71aa65208f4fe669f6d908fa2577b014bbfcad9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook

Also made some small formatting changes.
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++++
 .../dracut/files/kernel-uefi-hook-postinst    | 28 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 +++++++++++++
 srcpkgs/dracut/template                       | 20 +++++++++----
 4 files changed, 82 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..9bee61c1530
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# Options for the dracut-uefi kernel hook script installed by the dracut package.
+
+CREATE_UEFI_BUNDLES=0
+# To allow dracut to create EFI bundles, set
+#CREATE_UEFI_BUNDLES=1
+# This requires an EFI stub, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="root=..."
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# If you configure it there, set
+#SKIP_KERNEL_CMDLINE=1
+
+# You can set command line options for the dracut command
+#OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="/boot/efi/EFI/Void/"
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..606698dde53
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+	fi
+
+if [ -z "${KERNEL_CMDLINE}" ] && [ "x${SKIP_KERNEL_CMDLINE}" != x1 ]; then
+	echo "ERROR: You need to set the kernel command line in /etc/default/dracut-uefi-hook"
+	exit 1
+fi
+
+UEFI_BUNDLE_DIR="${UEFI_BUNDLE_DIR:-boot/efi/EFI/Void}"
+OPTIONS="${OPTIONS} --force --uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}"
+
+dracut --kernel-cmdline="${KERNEL_CMDLINE}" ${OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..96262222e7d
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+UEFI_BUNDLE_DIR="${UEFI_BUNDLE_DIR:-boot/efi/EFI/Void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..55fdf8390f4 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,10 +1,10 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
-conf_files="/etc/dracut.conf"
+conf_files="/etc/dracut.conf /etc/default/dracut-uefi-hook"
 hostmakedepends="asciidoc pkg-config"
 makedepends="libkmod-devel"
 depends="bash coreutils cpio eudev gzip kmod>=3.7 kpartx util-linux"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -40,6 +40,16 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	# EFI bundle config and hooks
+	case "$XBPS_TARGET_MACHINE" in
+		i686*|x86_64*|aarch64*)
+			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
+			;;
+	esac
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +62,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (2 preceding siblings ...)
  2020-06-01  2:59 ` ericonr
@ 2020-06-01  3:57 ` ericonr
  2020-06-01  7:32 ` ericonr
                   ` (58 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-06-01  3:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5322 bytes --]

From 298ab485a32995d0852adbcd0d7370ec4135d080 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook

Also made some small formatting changes.
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++++
 .../dracut/files/kernel-uefi-hook-postinst    | 28 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 +++++++++++++
 srcpkgs/dracut/template                       | 22 ++++++++++++---
 4 files changed, 85 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..9bee61c1530
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# Options for the dracut-uefi kernel hook script installed by the dracut package.
+
+CREATE_UEFI_BUNDLES=0
+# To allow dracut to create EFI bundles, set
+#CREATE_UEFI_BUNDLES=1
+# This requires an EFI stub, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="root=..."
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# If you configure it there, set
+#SKIP_KERNEL_CMDLINE=1
+
+# You can set command line options for the dracut command
+#OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="/boot/efi/EFI/Void/"
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..606698dde53
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+	fi
+
+if [ -z "${KERNEL_CMDLINE}" ] && [ "x${SKIP_KERNEL_CMDLINE}" != x1 ]; then
+	echo "ERROR: You need to set the kernel command line in /etc/default/dracut-uefi-hook"
+	exit 1
+fi
+
+UEFI_BUNDLE_DIR="${UEFI_BUNDLE_DIR:-boot/efi/EFI/Void}"
+OPTIONS="${OPTIONS} --force --uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}"
+
+dracut --kernel-cmdline="${KERNEL_CMDLINE}" ${OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..96262222e7d
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+UEFI_BUNDLE_DIR="${UEFI_BUNDLE_DIR:-boot/efi/EFI/Void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..78b2e0c7807 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +25,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		conf_files+=" /etc/default/dracut-uefi-hook"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +47,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +66,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (3 preceding siblings ...)
  2020-06-01  3:57 ` ericonr
@ 2020-06-01  7:32 ` ericonr
  2020-07-20  3:58 ` ericonr
                   ` (57 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-06-01  7:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5271 bytes --]

From 51d137a2145744378251163bf22a8b53da9e5a42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook

Also made some small formatting changes.
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++++
 .../dracut/files/kernel-uefi-hook-postinst    | 27 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 ++++++++++++++
 srcpkgs/dracut/template                       | 22 ++++++++++++---
 4 files changed, 84 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..9bee61c1530
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# Options for the dracut-uefi kernel hook script installed by the dracut package.
+
+CREATE_UEFI_BUNDLES=0
+# To allow dracut to create EFI bundles, set
+#CREATE_UEFI_BUNDLES=1
+# This requires an EFI stub, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="root=..."
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# If you configure it there, set
+#SKIP_KERNEL_CMDLINE=1
+
+# You can set command line options for the dracut command
+#OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="/boot/efi/EFI/Void/"
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..3c9a31eb2f5
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+	fi
+
+if [ -z "${KERNEL_CMDLINE}" ] && [ "x${SKIP_KERNEL_CMDLINE}" != x1 ]; then
+	echo "ERROR: You need to set the kernel command line in /etc/default/dracut-uefi-hook"
+	exit 1
+fi
+
+OPTIONS="${OPTIONS} --force --uefi ${UEFI_BUNDLE_DIR:=boot/efi/EFI/Void}/linux-${VERSION}.efi ${VERSION}"
+
+dracut --kernel-cmdline="${KERNEL_CMDLINE}" ${OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..985ad44c0aa
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/Void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..78b2e0c7807 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +25,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		conf_files+=" /etc/default/dracut-uefi-hook"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +47,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +66,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (4 preceding siblings ...)
  2020-06-01  7:32 ` ericonr
@ 2020-07-20  3:58 ` ericonr
  2020-07-20 14:41 ` [PR PATCH] [Updated] " ericonr
                   ` (56 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20  3:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-660788003

Comment:
@sgn could you take a look at this one?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (5 preceding siblings ...)
  2020-07-20  3:58 ` ericonr
@ 2020-07-20 14:41 ` ericonr
  2020-07-20 16:07 ` [PR REVIEW] " Duncaen
                   ` (55 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 14:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5812 bytes --]

From 2b956389040f8257a09c091664fc956dd3196089 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook.

- small formatting changes
- use relative path in kernel-hook-postrm
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++++
 srcpkgs/dracut/files/kernel-hook-postrm       |  4 +--
 .../dracut/files/kernel-uefi-hook-postinst    | 27 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 ++++++++++++++
 srcpkgs/dracut/template                       | 22 ++++++++++++---
 5 files changed, 86 insertions(+), 6 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..9bee61c1530
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# Options for the dracut-uefi kernel hook script installed by the dracut package.
+
+CREATE_UEFI_BUNDLES=0
+# To allow dracut to create EFI bundles, set
+#CREATE_UEFI_BUNDLES=1
+# This requires an EFI stub, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="root=..."
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# If you configure it there, set
+#SKIP_KERNEL_CMDLINE=1
+
+# You can set command line options for the dracut command
+#OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="/boot/efi/EFI/Void/"
diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm
index f35d076193b..f99458a4bfa 100644
--- a/srcpkgs/dracut/files/kernel-hook-postrm
+++ b/srcpkgs/dracut/files/kernel-hook-postrm
@@ -7,7 +7,7 @@
 PKGNAME="$1"
 VERSION="$2"
 
-if [ -f /boot/initramfs-${VERSION}.img ]; then
-	rm -f /boot/initramfs-${VERSION}.img
+if [ -f boot/initramfs-${VERSION}.img ]; then
+	rm -f boot/initramfs-${VERSION}.img
 fi
 exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..3c9a31eb2f5
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+	fi
+
+if [ -z "${KERNEL_CMDLINE}" ] && [ "x${SKIP_KERNEL_CMDLINE}" != x1 ]; then
+	echo "ERROR: You need to set the kernel command line in /etc/default/dracut-uefi-hook"
+	exit 1
+fi
+
+OPTIONS="${OPTIONS} --force --uefi ${UEFI_BUNDLE_DIR:=boot/efi/EFI/Void}/linux-${VERSION}.efi ${VERSION}"
+
+dracut --kernel-cmdline="${KERNEL_CMDLINE}" ${OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..985ad44c0aa
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/Void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..78b2e0c7807 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +25,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		conf_files+=" /etc/default/dracut-uefi-hook"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +47,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +66,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (7 preceding siblings ...)
  2020-07-20 16:07 ` [PR REVIEW] " Duncaen
@ 2020-07-20 16:07 ` Duncaen
  2020-07-20 16:07 ` Duncaen
                   ` (53 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: Duncaen @ 2020-07-20 16:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457524628

Comment:
I usually prefer set/unset for things like that.
and then just have something 
```
# uncomment to enable...
#CREATE_UEFI_BUNDLES=yes
```

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (6 preceding siblings ...)
  2020-07-20 14:41 ` [PR PATCH] [Updated] " ericonr
@ 2020-07-20 16:07 ` Duncaen
  2020-07-20 16:07 ` Duncaen
                   ` (54 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: Duncaen @ 2020-07-20 16:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457523836

Comment:
Is this logic necessary?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (8 preceding siblings ...)
  2020-07-20 16:07 ` Duncaen
@ 2020-07-20 16:07 ` Duncaen
  2020-07-20 16:16 ` sgn
                   ` (52 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: Duncaen @ 2020-07-20 16:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457524350

Comment:
`${foo:-default}` as you don't need to assign it.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (9 preceding siblings ...)
  2020-07-20 16:07 ` Duncaen
@ 2020-07-20 16:16 ` sgn
  2020-07-20 16:16 ` sgn
                   ` (51 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457499516

Comment:
`refind`, `grub` should work, too, no?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (12 preceding siblings ...)
  2020-07-20 16:16 ` sgn
@ 2020-07-20 16:16 ` sgn
  2020-07-20 16:16 ` sgn
                   ` (48 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457498757

Comment:
Probably, add some default:
```
quiet page_poison=1 slub_debug=P
```

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (11 preceding siblings ...)
  2020-07-20 16:16 ` sgn
@ 2020-07-20 16:16 ` sgn
  2020-07-20 16:16 ` sgn
                   ` (49 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457507633

Comment:
Maybe `void` lowercase `v` is better.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (13 preceding siblings ...)
  2020-07-20 16:16 ` sgn
@ 2020-07-20 16:16 ` sgn
  2020-07-20 16:16 ` sgn
                   ` (47 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457531780

Comment:
And I'm thinking about supporting this in `sbsigntool` and `refind` hooks.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (10 preceding siblings ...)
  2020-07-20 16:16 ` sgn
@ 2020-07-20 16:16 ` sgn
  2020-07-20 16:16 ` sgn
                   ` (50 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457506802

Comment:
```sh
mkdir -p "$UEFI_BUNDLE_DIR"
```

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (14 preceding siblings ...)
  2020-07-20 16:16 ` sgn
@ 2020-07-20 16:16 ` sgn
  2020-07-20 16:20 ` sgn
                   ` (46 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457503016

Comment:
I think `DRACUT_OPTIONS` is better.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (15 preceding siblings ...)
  2020-07-20 16:16 ` sgn
@ 2020-07-20 16:20 ` sgn
  2020-07-20 16:28 ` sgn
                   ` (45 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457534692

Comment:
disregard this one, I was wrong.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (16 preceding siblings ...)
  2020-07-20 16:20 ` sgn
@ 2020-07-20 16:28 ` sgn
  2020-07-20 18:17 ` ericonr
                   ` (44 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-20 16:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457539719

Comment:
`dracut` is talkative, `-q` should be used, I think.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (17 preceding siblings ...)
  2020-07-20 16:28 ` sgn
@ 2020-07-20 18:17 ` ericonr
  2020-07-20 18:18 ` ericonr
                   ` (43 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 18:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457602895

Comment:
It's solving the issue that if dracut doesn't find a `kernel_cmdline` entry in a `dracut.conf` file and isn't passed a cmdline in the command line argumets, it will prompt the user for a cmdline.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (18 preceding siblings ...)
  2020-07-20 18:17 ` ericonr
@ 2020-07-20 18:18 ` ericonr
  2020-07-20 18:23 ` ericonr
                   ` (42 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 18:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457603233

Comment:
I couldn't think of another way of solving this particular issue.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (19 preceding siblings ...)
  2020-07-20 18:18 ` ericonr
@ 2020-07-20 18:23 ` ericonr
  2020-07-20 18:26 ` ericonr
                   ` (41 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 18:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457606012

Comment:
I picked the one from our Grub config.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (20 preceding siblings ...)
  2020-07-20 18:23 ` ericonr
@ 2020-07-20 18:26 ` ericonr
  2020-07-20 18:26 ` ericonr
                   ` (40 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 18:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457607595

Comment:
> And I'm thinking about supporting this in sbsigntool and refind hooks.

How would this look?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (21 preceding siblings ...)
  2020-07-20 18:26 ` ericonr
@ 2020-07-20 18:26 ` ericonr
  2020-07-20 18:28 ` [PR PATCH] [Updated] " ericonr
                   ` (39 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 18:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457607803

Comment:
Yup!

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (22 preceding siblings ...)
  2020-07-20 18:26 ` ericonr
@ 2020-07-20 18:28 ` ericonr
  2020-07-20 23:05 ` [PR REVIEW] " ericonr
                   ` (38 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 18:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5882 bytes --]

From 81c34c257cf36781d67b3d23eff3bb3d0538e403 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook.

- small formatting changes
- use relative path in kernel-hook-postrm
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 18 ++++++++++++
 srcpkgs/dracut/files/kernel-hook-postrm       |  4 +--
 .../dracut/files/kernel-uefi-hook-postinst    | 28 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 +++++++++++++
 srcpkgs/dracut/template                       | 22 ++++++++++++---
 5 files changed, 86 insertions(+), 6 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..d56d13241b5
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,18 @@
+# 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, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="loglevel=4 slub_debug=P page_poison=1"
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# If you configure it there, set
+#SKIP_KERNEL_CMDLINE=1
+
+# You can set command line options for the dracut command
+#DRACUT_OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="boot/efi/EFI/void/"
diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm
index f35d076193b..f99458a4bfa 100644
--- a/srcpkgs/dracut/files/kernel-hook-postrm
+++ b/srcpkgs/dracut/files/kernel-hook-postrm
@@ -7,7 +7,7 @@
 PKGNAME="$1"
 VERSION="$2"
 
-if [ -f /boot/initramfs-${VERSION}.img ]; then
-	rm -f /boot/initramfs-${VERSION}.img
+if [ -f boot/initramfs-${VERSION}.img ]; then
+	rm -f boot/initramfs-${VERSION}.img
 fi
 exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..45023a6c896
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+if [ -z "${KERNEL_CMDLINE}" ] && [ "x${SKIP_KERNEL_CMDLINE}" != x1 ]; then
+	echo "ERROR: You need to set the kernel command line in /etc/default/dracut-uefi-hook"
+	exit 1
+fi
+
+DRACUT_OPTIONS="${DRACUT_OPTIONS} --force --uefi ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}/linux-${VERSION}.efi ${VERSION}"
+mkdir -p "${UEFI_BUNDLE_DIR}"
+
+dracut -q --kernel-cmdline="${KERNEL_CMDLINE}" ${DRACUT_OPTIONS}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..985ad44c0aa
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/Void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..78b2e0c7807 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +25,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		conf_files+=" /etc/default/dracut-uefi-hook"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +47,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +66,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (23 preceding siblings ...)
  2020-07-20 18:28 ` [PR PATCH] [Updated] " ericonr
@ 2020-07-20 23:05 ` ericonr
  2020-07-20 23:06 ` ericonr
                   ` (37 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 23:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457740786

Comment:
The other way of solving this would be always passing at least an empty string to the command line parameter.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (24 preceding siblings ...)
  2020-07-20 23:05 ` [PR REVIEW] " ericonr
@ 2020-07-20 23:06 ` ericonr
  2020-07-20 23:32 ` ahesford
                   ` (36 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 23:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457740786

Comment:
The other way of solving this would be always passing at least an empty string to the command line parameter. But it doesn't protect the user from dumb mistakes.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (25 preceding siblings ...)
  2020-07-20 23:06 ` ericonr
@ 2020-07-20 23:32 ` ahesford
  2020-07-20 23:39 ` ericonr
                   ` (35 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2020-07-20 23:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457749153

Comment:
That seems like a good option, provided it has no unanticipated side effects.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (26 preceding siblings ...)
  2020-07-20 23:32 ` ahesford
@ 2020-07-20 23:39 ` ericonr
  2020-07-20 23:43 ` ericonr
                   ` (34 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 23:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 209 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457751075

Comment:
I would still prefer erroring out, but if you think it's fine.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (27 preceding siblings ...)
  2020-07-20 23:39 ` ericonr
@ 2020-07-20 23:43 ` ericonr
  2020-07-21  0:12 ` sgn
                   ` (33 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-20 23:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457752293

Comment:
Hmm there's also the use case without secure boot that allows the bundle to use the cmdline from refind/grub, so the command line could be empty.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (28 preceding siblings ...)
  2020-07-20 23:43 ` ericonr
@ 2020-07-21  0:12 ` sgn
  2020-07-21  0:12 ` sgn
                   ` (32 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-21  0:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457760759

Comment:
Just write a warning in the configuration file, and let the user see the boot failure :shrug: 
Don't bother with it, I would say.


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (29 preceding siblings ...)
  2020-07-21  0:12 ` sgn
@ 2020-07-21  0:12 ` sgn
  2020-07-21  0:16 ` sgn
                   ` (31 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-21  0:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457760274

Comment:
```sh
dracut -q ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} ${DRACUT_OPTIONS}
```
looks better?


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (30 preceding siblings ...)
  2020-07-21  0:12 ` sgn
@ 2020-07-21  0:16 ` sgn
  2020-07-21  0:17 ` ahesford
                   ` (30 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-21  0:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457762207

Comment:
Force them read this hooks if exists, maybe.
Rather messy but I don't like different parts of system refusing co-operating with each others. Just make sure variable introduced by this change doesn't overlap with them, I can make it works.
I like this idea, (so I can sign the whole efi, my initrd is unsigned, now) but I don't use gummiboot, for example.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (31 preceding siblings ...)
  2020-07-21  0:16 ` sgn
@ 2020-07-21  0:17 ` ahesford
  2020-07-21  0:27 ` ericonr
                   ` (29 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2020-07-21  0:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457762378

Comment:
I think the issue is that, if you don't set `kernel_cmdline` in the config file or the `dracut` command line, the user will be prompted for a value, which will stall the hook. @ericonr, is this correct?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (32 preceding siblings ...)
  2020-07-21  0:17 ` ahesford
@ 2020-07-21  0:27 ` ericonr
  2020-07-21  1:05 ` sgn
                   ` (28 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-21  0:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457765235

Comment:
It does!

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (33 preceding siblings ...)
  2020-07-21  0:27 ` ericonr
@ 2020-07-21  1:05 ` sgn
  2020-07-21  1:12 ` ericonr
                   ` (27 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-21  1:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457775764

Comment:
Something like this to prepare for it
https://github.com/sgn/void-packages/commit/9bbcb81662861205e5fb70ceeb567d2b1a56a281

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (34 preceding siblings ...)
  2020-07-21  1:05 ` sgn
@ 2020-07-21  1:12 ` ericonr
  2020-07-21  1:21 ` ericonr
                   ` (26 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-21  1:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457777484

Comment:
Gah I hadn't seen @ahesford's comment.

So, that one does look better, and if I add the `-q` argument to dracut it simply plows ahead and gets an empty cmdline. So it should be fine.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (35 preceding siblings ...)
  2020-07-21  1:12 ` ericonr
@ 2020-07-21  1:21 ` ericonr
  2020-07-21  1:23 ` [PR PATCH] [Updated] " ericonr
                   ` (25 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-21  1:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 169 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r457780109

Comment:
Cool! I like the idea.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (36 preceding siblings ...)
  2020-07-21  1:21 ` ericonr
@ 2020-07-21  1:23 ` ericonr
  2020-07-21  1:24 ` ericonr
                   ` (24 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-21  1:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5825 bytes --]

From a86d75ab8ca951502e18f111b25f293a5b404e41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook.

- small formatting changes
- use relative path in kernel-hook-postrm
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++++++
 srcpkgs/dracut/files/kernel-hook-postrm       |  4 ++--
 .../dracut/files/kernel-uefi-hook-postinst    | 23 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 ++++++++++++++++
 srcpkgs/dracut/template                       | 22 ++++++++++++++----
 5 files changed, 82 insertions(+), 6 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..fc96090b38d
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# 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, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+# Booting without a kernel command line is unsupported.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="loglevel=4 slub_debug=P page_poison=1"
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# The bundle can also use the command line from a bootloader / boot manager
+# if Secure Boot is disabled.
+
+# You can set command line options for the dracut command
+#DRACUT_OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="boot/efi/EFI/void/"
diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm
index f35d076193b..f99458a4bfa 100644
--- a/srcpkgs/dracut/files/kernel-hook-postrm
+++ b/srcpkgs/dracut/files/kernel-hook-postrm
@@ -7,7 +7,7 @@
 PKGNAME="$1"
 VERSION="$2"
 
-if [ -f /boot/initramfs-${VERSION}.img ]; then
-	rm -f /boot/initramfs-${VERSION}.img
+if [ -f boot/initramfs-${VERSION}.img ]; then
+	rm -f boot/initramfs-${VERSION}.img
 fi
 exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..516458f3a7f
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+mkdir -p ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}/linux-${VERSION}.efi
+
+dracut -q --force ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} ${DRACUT_OPTIONS} \
+	--uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..985ad44c0aa
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ "x${CREATE_UEFI_BUNDLES}" != x1 ]; then
+	exit 0
+fi
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/Void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index 3c6aca0ada6..78b2e0c7807 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=2
+revision=3
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +25,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		conf_files+=" /etc/default/dracut-uefi-hook"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +47,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +66,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (37 preceding siblings ...)
  2020-07-21  1:23 ` [PR PATCH] [Updated] " ericonr
@ 2020-07-21  1:24 ` ericonr
  2020-07-27 11:56 ` sgn
                   ` (23 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-21  1:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-661531250

Comment:
Updated again.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (38 preceding siblings ...)
  2020-07-21  1:24 ` ericonr
@ 2020-07-27 11:56 ` sgn
  2020-07-27 12:39 ` ericonr
                   ` (22 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 11:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664352260

Comment:
Is this ready?

Or are we better to split the uefi bundle hook and gummiboot?

If this is ready, I'll merge this in, without worrying about other option.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (39 preceding siblings ...)
  2020-07-27 11:56 ` sgn
@ 2020-07-27 12:39 ` ericonr
  2020-07-27 12:49 ` [PR REVIEW] " sgn
                   ` (21 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 12:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664371096

Comment:
I don't think it's fully ready, the post remove hook isn't using `-z` to detect if it should do anything. Btw, how do we deal with 

```
if [ ! -x bin/dracut ]; then
	exit 0
fi
```

? Should it exit with 1 and show an error, since having the hook installed but not dracut is an issue?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (40 preceding siblings ...)
  2020-07-27 12:39 ` ericonr
@ 2020-07-27 12:49 ` sgn
  2020-07-27 12:49 ` sgn
                   ` (20 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 12:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r460865614

Comment:
Lowercase `V` in `Void`.
Since grub will create this very same directory with lowercase `void`.
I'm not sure what they will do if they're conflicting now.
And I couldn't say about their future.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (41 preceding siblings ...)
  2020-07-27 12:49 ` [PR REVIEW] " sgn
@ 2020-07-27 12:49 ` sgn
  2020-07-27 12:51 ` [PR PATCH] [Updated] " ericonr
                   ` (19 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 12:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 222 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r460865036

Comment:
I don't think we need this check.
Just check if the file exist then remove it?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (42 preceding siblings ...)
  2020-07-27 12:49 ` sgn
@ 2020-07-27 12:51 ` ericonr
  2020-07-27 12:52 ` [PR REVIEW] " ericonr
                   ` (18 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 12:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5800 bytes --]

From 53da9d8d7a266f719bcb8eee811a3bb6b40012dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook.

- small formatting changes
- use relative path in kernel-hook-postrm
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++++++
 srcpkgs/dracut/files/kernel-hook-postrm       |  4 ++--
 .../dracut/files/kernel-uefi-hook-postinst    | 23 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 ++++++++++++++++
 srcpkgs/dracut/template                       | 22 ++++++++++++++----
 5 files changed, 82 insertions(+), 6 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..fc96090b38d
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# 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, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+# Booting without a kernel command line is unsupported.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="loglevel=4 slub_debug=P page_poison=1"
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# The bundle can also use the command line from a bootloader / boot manager
+# if Secure Boot is disabled.
+
+# You can set command line options for the dracut command
+#DRACUT_OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="boot/efi/EFI/void/"
diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm
index f35d076193b..f99458a4bfa 100644
--- a/srcpkgs/dracut/files/kernel-hook-postrm
+++ b/srcpkgs/dracut/files/kernel-hook-postrm
@@ -7,7 +7,7 @@
 PKGNAME="$1"
 VERSION="$2"
 
-if [ -f /boot/initramfs-${VERSION}.img ]; then
-	rm -f /boot/initramfs-${VERSION}.img
+if [ -f boot/initramfs-${VERSION}.img ]; then
+	rm -f boot/initramfs-${VERSION}.img
 fi
 exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..d623c3f86df
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+mkdir -p ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}
+
+dracut -q --force ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} ${DRACUT_OPTIONS} \
+	--uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..09b90fe623e
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index b11335d06e3..ed9c0e8def0 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=3
+revision=4
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +25,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		conf_files+=" /etc/default/dracut-uefi-hook"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +47,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +66,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (43 preceding siblings ...)
  2020-07-27 12:51 ` [PR PATCH] [Updated] " ericonr
@ 2020-07-27 12:52 ` ericonr
  2020-07-27 12:52 ` [PR PATCH] [Updated] " ericonr
                   ` (17 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 12:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r460867184

Comment:
Agree.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (44 preceding siblings ...)
  2020-07-27 12:52 ` [PR REVIEW] " ericonr
@ 2020-07-27 12:52 ` ericonr
  2020-07-27 12:53 ` sgn
                   ` (16 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 12:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 5800 bytes --]

From 53da9d8d7a266f719bcb8eee811a3bb6b40012dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add EFI kernel hook.

- small formatting changes
- use relative path in kernel-hook-postrm
---
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++++++
 srcpkgs/dracut/files/kernel-hook-postrm       |  4 ++--
 .../dracut/files/kernel-uefi-hook-postinst    | 23 +++++++++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 20 ++++++++++++++++
 srcpkgs/dracut/template                       | 22 ++++++++++++++----
 5 files changed, 82 insertions(+), 6 deletions(-)
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..fc96090b38d
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# 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, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+# Booting without a kernel command line is unsupported.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="loglevel=4 slub_debug=P page_poison=1"
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# The bundle can also use the command line from a bootloader / boot manager
+# if Secure Boot is disabled.
+
+# You can set command line options for the dracut command
+#DRACUT_OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="boot/efi/EFI/void/"
diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm
index f35d076193b..f99458a4bfa 100644
--- a/srcpkgs/dracut/files/kernel-hook-postrm
+++ b/srcpkgs/dracut/files/kernel-hook-postrm
@@ -7,7 +7,7 @@
 PKGNAME="$1"
 VERSION="$2"
 
-if [ -f /boot/initramfs-${VERSION}.img ]; then
-	rm -f /boot/initramfs-${VERSION}.img
+if [ -f boot/initramfs-${VERSION}.img ]; then
+	rm -f boot/initramfs-${VERSION}.img
 fi
 exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..d623c3f86df
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+mkdir -p ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}
+
+dracut -q --force ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} ${DRACUT_OPTIONS} \
+	--uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..09b90fe623e
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index b11335d06e3..ed9c0e8def0 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=3
+revision=4
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -16,8 +16,8 @@ distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +25,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		conf_files+=" /etc/default/dracut-uefi-hook"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +47,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,7 +66,7 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (45 preceding siblings ...)
  2020-07-27 12:52 ` [PR PATCH] [Updated] " ericonr
@ 2020-07-27 12:53 ` sgn
  2020-07-27 12:54 ` sgn
                   ` (15 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 12:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664377817

Comment:
> I don't think it's fully ready, the post remove hook isn't using `-z` to detect if it should do anything.
> Btw, how do we deal with
> 
> ```
> if [ ! -x bin/dracut ]; then
> 	exit 0
> fi
> ```

If this hook is included with `dracut`, this check is likely unnecessary.
Albeit, we should use `usr/bin/dracut` instead?

But, this hook is depended on both `dracut` and an efi file provided by `gummiboot`.
I'm not sure if it's better to split it out and explicitly `depends` on `gummiboot`?

> ? Should it exit with 1 and show an error, since having the hook installed but not dracut is an issue?

**I** don't care about the broken system _if their owners choose to break it_



^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (46 preceding siblings ...)
  2020-07-27 12:53 ` sgn
@ 2020-07-27 12:54 ` sgn
  2020-07-27 12:56 ` sgn
                   ` (14 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 12:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664377817

Comment:
> I don't think it's fully ready, the post remove hook isn't using `-z` to detect if it should do anything.
> Btw, how do we deal with
> 
> ```
> if [ ! -x bin/dracut ]; then
> 	exit 0
> fi
> ```

If this hook is included with `dracut`, this check is likely unnecessary.
Albeit, we should use `usr/bin/dracut` instead?

But, this hook is depended on both `dracut` and an efi file provided by `gummiboot`.
I'm not sure if it's better to split it out and explicitly `depends` on `gummiboot`?

> ? Should it exit with 1 and show an error, since having the hook installed but not dracut is an issue?

**I, myself,** don't care about the broken system _if their owners choose to break it_




^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (47 preceding siblings ...)
  2020-07-27 12:54 ` sgn
@ 2020-07-27 12:56 ` sgn
  2020-07-27 12:58 ` ericonr
                   ` (13 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 12:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 839 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664377817

Comment:
> I don't think it's fully ready, the post remove hook isn't using `-z` to detect if it should do anything.
> Btw, how do we deal with
> 
> ```
> if [ ! -x bin/dracut ]; then
> 	exit 0
> fi
> ```

If this hook is included with `dracut`, this check is likely unnecessary.
Albeit, we should use `usr/bin/dracut` instead?

But, this hook depends on both `dracut` and an efi file provided by `gummiboot`.
I'm not sure if it's better to split it out and explicitly `depends` on `gummiboot`?

> ? Should it exit with 1 and show an error, since having the hook installed but not dracut is an issue?

**I, myself,** don't care about the broken system _if their owners choose to break it_




^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (48 preceding siblings ...)
  2020-07-27 12:56 ` sgn
@ 2020-07-27 12:58 ` ericonr
  2020-07-27 13:04 ` sgn
                   ` (12 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 12:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664380417

Comment:
> If this hook is included with dracut, this check is likely unnecessary.

I agree. It is mostly following the style of the other hook, that's why it has the check.

> I'm not sure if it's better to split it out and explicitly depends on gummiboot?

Hmm that might be a better way of doing it. We mention the dependency in the config file, at least. Would it be okay to have a subpackage only for the hook and the conf file?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (49 preceding siblings ...)
  2020-07-27 12:58 ` ericonr
@ 2020-07-27 13:04 ` sgn
  2020-07-27 13:09 ` ericonr
                   ` (11 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 13:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 958 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664383633

Comment:
On 2020-07-27 05:59:09-0700, Érico Nogueira Rolim <notifications@github.com> wrote:
> > If this hook is included with dracut, this check is likely unnecessary.
> 
> I agree. It is mostly following the style of the other hook, that's why it has the check.
> 
> > I'm not sure if it's better to split it out and explicitly depends on gummiboot?
> 
> Hmm that might be a better way of doing it. We mention the
> dependency in the config file, at least. Would it be okay to have
> a subpackage only for the hook and the conf file?

I support for subpackage, don't know about other.
We have a ton of meta package already,
and despite this package is a single POSIX script and a config,
it must be installed in system level.

Still better than `sx` which is single 4x line bash script,
which I want to remove badly.

-- 
Danh


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (50 preceding siblings ...)
  2020-07-27 13:04 ` sgn
@ 2020-07-27 13:09 ` ericonr
  2020-07-27 13:18 ` [PR PATCH] [Updated] " ericonr
                   ` (10 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 13:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664386165

Comment:
Heh, ok! Will split it off.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (51 preceding siblings ...)
  2020-07-27 13:09 ` ericonr
@ 2020-07-27 13:18 ` ericonr
  2020-07-27 13:19 ` ericonr
                   ` (9 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 13:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 6504 bytes --]

From eec3911242b8cf6240c442dc36fcd5494aa4c5a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add UEFI bundle hook in dracut-uefi subpkg

- small formatting changes
- use relative path in kernel-hook-postrm
---
 srcpkgs/dracut-uefi                           |  1 +
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++
 srcpkgs/dracut/files/kernel-hook-postrm       |  4 +--
 .../dracut/files/kernel-uefi-hook-postinst    | 23 +++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 17 ++++++++++
 srcpkgs/dracut/template                       | 34 ++++++++++++++++---
 6 files changed, 92 insertions(+), 6 deletions(-)
 create mode 120000 srcpkgs/dracut-uefi
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut-uefi b/srcpkgs/dracut-uefi
new file mode 120000
index 00000000000..b3ae25a9bdd
--- /dev/null
+++ b/srcpkgs/dracut-uefi
@@ -0,0 +1 @@
+dracut
\ No newline at end of file
diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..fc96090b38d
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# 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, usually provided by the gummiboot package,
+# as well as setting the kernel command line.
+# Booting without a kernel command line is unsupported.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="loglevel=4 slub_debug=P page_poison=1"
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# The bundle can also use the command line from a bootloader / boot manager
+# if Secure Boot is disabled.
+
+# You can set command line options for the dracut command
+#DRACUT_OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="boot/efi/EFI/void/"
diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm
index f35d076193b..f99458a4bfa 100644
--- a/srcpkgs/dracut/files/kernel-hook-postrm
+++ b/srcpkgs/dracut/files/kernel-hook-postrm
@@ -7,7 +7,7 @@
 PKGNAME="$1"
 VERSION="$2"
 
-if [ -f /boot/initramfs-${VERSION}.img ]; then
-	rm -f /boot/initramfs-${VERSION}.img
+if [ -f boot/initramfs-${VERSION}.img ]; then
+	rm -f boot/initramfs-${VERSION}.img
 fi
 exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..d623c3f86df
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+mkdir -p ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}
+
+dracut -q --force ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} ${DRACUT_OPTIONS} \
+	--uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..8183bb26f08
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index b11335d06e3..00a7f801192 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=3
+revision=4
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -14,10 +14,11 @@ license="GPL-2.0-or-later, LGPL-2.0-or-later"
 homepage="http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html"
 distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
+subpackages="dracut-network"
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +26,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		subpackages+=" dracut-uefi"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +48,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,8 +67,19 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}
 }
+
+dracut-uefi_package() {
+	depends="gummiboot dracut-${version}_${revision}"
+	short_desc+=" - UEFI bundle hook"
+	conf_files="/etc/default/dracut-uefi-hook"
+	pkg_install() {
+		vmove etc/kernel.d/post-install/20-dracut-uefi
+		vmove etc/kernel.d/post-remove/20-dracut-uefi
+		vmove etc/default/dracut-uefi-hook
+	}
+}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (52 preceding siblings ...)
  2020-07-27 13:18 ` [PR PATCH] [Updated] " ericonr
@ 2020-07-27 13:19 ` ericonr
  2020-07-27 13:20 ` [PR PATCH] [Updated] " ericonr
                   ` (8 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 13:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 146 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664391612

Comment:
Done.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR PATCH] [Updated] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (53 preceding siblings ...)
  2020-07-27 13:19 ` ericonr
@ 2020-07-27 13:20 ` ericonr
  2020-07-27 13:25 ` sgn
                   ` (7 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 13:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages dracut
https://github.com/void-linux/void-packages/pull/22484

dracut: add EFI kernel hook
Also made some small formatting changes.

@ahesford 

A patch file from https://github.com/void-linux/void-packages/pull/22484.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dracut-22484.patch --]
[-- Type: text/x-diff, Size: 6496 bytes --]

From 9e3e7cb1b3c07ebe1c92c3d381fe211567cbb06b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Sun, 31 May 2020 21:39:55 -0300
Subject: [PATCH] dracut: add UEFI bundle hook in dracut-uefi subpkg

- small formatting changes
- use relative path in kernel-hook-postrm
---
 srcpkgs/dracut-uefi                           |  1 +
 srcpkgs/dracut/files/dracut-uefi-hook.confd   | 19 +++++++++++
 srcpkgs/dracut/files/kernel-hook-postrm       |  4 +--
 .../dracut/files/kernel-uefi-hook-postinst    | 23 +++++++++++++
 srcpkgs/dracut/files/kernel-uefi-hook-postrm  | 17 ++++++++++
 srcpkgs/dracut/template                       | 34 ++++++++++++++++---
 6 files changed, 92 insertions(+), 6 deletions(-)
 create mode 120000 srcpkgs/dracut-uefi
 create mode 100644 srcpkgs/dracut/files/dracut-uefi-hook.confd
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postinst
 create mode 100644 srcpkgs/dracut/files/kernel-uefi-hook-postrm

diff --git a/srcpkgs/dracut-uefi b/srcpkgs/dracut-uefi
new file mode 120000
index 00000000000..b3ae25a9bdd
--- /dev/null
+++ b/srcpkgs/dracut-uefi
@@ -0,0 +1 @@
+dracut
\ No newline at end of file
diff --git a/srcpkgs/dracut/files/dracut-uefi-hook.confd b/srcpkgs/dracut/files/dracut-uefi-hook.confd
new file mode 100644
index 00000000000..50647c483a9
--- /dev/null
+++ b/srcpkgs/dracut/files/dracut-uefi-hook.confd
@@ -0,0 +1,19 @@
+# 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.
+
+# You can set the kernel command line with
+#KERNEL_CMDLINE="loglevel=4 slub_debug=P page_poison=1"
+# or by setting kernel_cmdline in a dracut.conf(5) file.
+# The bundle can also use the command line from a bootloader / boot manager
+# if Secure Boot is disabled.
+
+# You can set command line options for the dracut command
+#DRACUT_OPTIONS=
+
+# Output directory for the EFI bundle
+#UEFI_BUNDLE_DIR="boot/efi/EFI/void/"
diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm
index f35d076193b..f99458a4bfa 100644
--- a/srcpkgs/dracut/files/kernel-hook-postrm
+++ b/srcpkgs/dracut/files/kernel-hook-postrm
@@ -7,7 +7,7 @@
 PKGNAME="$1"
 VERSION="$2"
 
-if [ -f /boot/initramfs-${VERSION}.img ]; then
-	rm -f /boot/initramfs-${VERSION}.img
+if [ -f boot/initramfs-${VERSION}.img ]; then
+	rm -f boot/initramfs-${VERSION}.img
 fi
 exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
new file mode 100644
index 00000000000..d623c3f86df
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Kernel post-install hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+if [ -z "${CREATE_UEFI_BUNDLES}" ]; then
+	exit 0
+fi
+
+if [ ! -x bin/dracut ]; then
+	exit 0
+fi
+
+mkdir -p ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}
+
+dracut -q --force ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} ${DRACUT_OPTIONS} \
+	--uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION}
+exit $?
diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
new file mode 100644
index 00000000000..8183bb26f08
--- /dev/null
+++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Kernel post-remove hook for dracut EFI bundle.
+#
+# Arguments passed to this script: $1 pkgname, $2 version.
+#
+PKGNAME="$1"
+VERSION="$2"
+
+. "${ROOTDIR}/etc/default/dracut-uefi-hook"
+
+: "${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}"
+
+if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then
+	rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi"
+fi
+exit $?
diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template
index b11335d06e3..00a7f801192 100644
--- a/srcpkgs/dracut/template
+++ b/srcpkgs/dracut/template
@@ -1,7 +1,7 @@
 # Template file for 'dracut'
 pkgname=dracut
 version=050
-revision=3
+revision=4
 build_style=configure
 configure_args="--prefix=/usr --sysconfdir=/etc"
 conf_files="/etc/dracut.conf"
@@ -14,10 +14,11 @@ license="GPL-2.0-or-later, LGPL-2.0-or-later"
 homepage="http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html"
 distfiles="https://github.com/dracutdevs/dracut/archive/${version}.tar.gz"
 checksum=f9dbf18597e5929221365964293212c8c9ffb7d84529c5a338c834ecab06e333
+subpackages="dracut-network"
 
 make_dirs="
-	/etc/dracut.conf.d 0755 root root
-	/usr/lib/dracut/dracut.conf.d 0755 root root"
+ /etc/dracut.conf.d 0755 root root
+ /usr/lib/dracut/dracut.conf.d 0755 root root"
 
 case "$XBPS_TARGET_MACHINE" in
 *-musl) # Add musl-fts implementation
@@ -25,6 +26,13 @@ case "$XBPS_TARGET_MACHINE" in
 	;;
 esac
 
+case "$XBPS_TARGET_MACHINE" in
+	i686*|x86_64*|aarch64*) # EFI bundle config and hooks
+		_efi_bundle=1
+		subpackages+=" dracut-uefi"
+	;;
+esac
+
 do_build() {
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl) make ${makejobs} LDLIBS="-lfts" ;;
@@ -40,6 +48,13 @@ post_install() {
 	# kernel hooks.
 	vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-dracut
 	vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-dracut
+
+	if [ "${_efi_bundle}" ]; then
+		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
+	fi
+
 	# We don't need the systemd stuff.
 	rm -rf ${DESTDIR}/usr/lib/dracut/modules.d/*systemd*
 	rm -f ${DESTDIR}/usr/share/man/man8/*.service.*
@@ -52,8 +67,19 @@ dracut-network_package() {
 	archs=noarch
 	pkg_install() {
 		for f in 40network 90livenet 95fcoe 95iscsi \
-		    95nbd 95nfs 95zfcp 95znet; do
+			95nbd 95nfs 95zfcp 95znet; do
 			vmove usr/lib/dracut/modules.d/${f}
 		done
 	}
 }
+
+dracut-uefi_package() {
+	depends="gummiboot dracut-${version}_${revision}"
+	short_desc+=" - UEFI bundle hook"
+	conf_files="/etc/default/dracut-uefi-hook"
+	pkg_install() {
+		vmove etc/kernel.d/post-install/20-dracut-uefi
+		vmove etc/kernel.d/post-remove/20-dracut-uefi
+		vmove etc/default/dracut-uefi-hook
+	}
+}

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (54 preceding siblings ...)
  2020-07-27 13:20 ` [PR PATCH] [Updated] " ericonr
@ 2020-07-27 13:25 ` sgn
  2020-07-27 13:28 ` ericonr
                   ` (6 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: sgn @ 2020-07-27 13:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

New comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664394766

Comment:
Looks good. I hope you don't mind to wait for few days to let other people complain :D

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (55 preceding siblings ...)
  2020-07-27 13:25 ` sgn
@ 2020-07-27 13:28 ` ericonr
  2020-07-27 13:29 ` ericonr
                   ` (5 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 13:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664396391

Comment:
No worries, I'm not even using it any more :p 

Thanks!

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (56 preceding siblings ...)
  2020-07-27 13:28 ` ericonr
@ 2020-07-27 13:29 ` ericonr
  2020-07-27 13:36 ` [PR REVIEW] " ahesford
                   ` (4 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ericonr @ 2020-07-27 13:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#issuecomment-664396391

Comment:
No worries, I'm not even using it any more :p 

Thanks!

Edit: I am not using on my main device, I am indeed using it on my old one.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (57 preceding siblings ...)
  2020-07-27 13:29 ` ericonr
@ 2020-07-27 13:36 ` ahesford
  2020-07-27 13:36 ` ahesford
                   ` (3 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2020-07-27 13:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r460894234

Comment:
Why is this needed, and should dracut-uefi be included?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (58 preceding siblings ...)
  2020-07-27 13:36 ` [PR REVIEW] " ahesford
@ 2020-07-27 13:36 ` ahesford
  2021-07-07 21:24 ` jirutka
                   ` (2 subsequent siblings)
  62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2020-07-27 13:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r460894620

Comment:
Nevermind, didn't read far enough down...

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (59 preceding siblings ...)
  2020-07-27 13:36 ` ahesford
@ 2021-07-07 21:24 ` jirutka
  2021-07-07 21:55 ` ahesford
  2021-07-07 22:47 ` jirutka
  62 siblings, 0 replies; 64+ messages in thread
From: jirutka @ 2021-07-07 21:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

New review comment by jirutka on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r665716166

Comment:
Why does it depend on `gummibot`? It’s not needed for booting Linux via EFISTUB.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (60 preceding siblings ...)
  2021-07-07 21:24 ` jirutka
@ 2021-07-07 21:55 ` ahesford
  2021-07-07 22:47 ` jirutka
  62 siblings, 0 replies; 64+ messages in thread
From: ahesford @ 2021-07-07 21:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r665731089

Comment:
The dracut UEFI bundle requires a separate UEFI stub provided (in our case) by gummiboot.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PR REVIEW] dracut: add EFI kernel hook
  2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
                   ` (61 preceding siblings ...)
  2021-07-07 21:55 ` ahesford
@ 2021-07-07 22:47 ` jirutka
  62 siblings, 0 replies; 64+ messages in thread
From: jirutka @ 2021-07-07 22:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

New review comment by jirutka on void-packages repository

https://github.com/void-linux/void-packages/pull/22484#discussion_r665716166

Comment:
Why does it depend on `gummibot`? It’s not needed for booting Linux via EFISTUB.

^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2021-07-07 22:47 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01  0:41 [PR PATCH] dracut: add EFI kernel hook ericonr
2020-06-01  0:47 ` [PR PATCH] [Updated] " ericonr
2020-06-01  1:06 ` ericonr
2020-06-01  2:59 ` ericonr
2020-06-01  3:57 ` ericonr
2020-06-01  7:32 ` ericonr
2020-07-20  3:58 ` ericonr
2020-07-20 14:41 ` [PR PATCH] [Updated] " ericonr
2020-07-20 16:07 ` [PR REVIEW] " Duncaen
2020-07-20 16:07 ` Duncaen
2020-07-20 16:07 ` Duncaen
2020-07-20 16:16 ` sgn
2020-07-20 16:16 ` sgn
2020-07-20 16:16 ` sgn
2020-07-20 16:16 ` sgn
2020-07-20 16:16 ` sgn
2020-07-20 16:16 ` sgn
2020-07-20 16:20 ` sgn
2020-07-20 16:28 ` sgn
2020-07-20 18:17 ` ericonr
2020-07-20 18:18 ` ericonr
2020-07-20 18:23 ` ericonr
2020-07-20 18:26 ` ericonr
2020-07-20 18:26 ` ericonr
2020-07-20 18:28 ` [PR PATCH] [Updated] " ericonr
2020-07-20 23:05 ` [PR REVIEW] " ericonr
2020-07-20 23:06 ` ericonr
2020-07-20 23:32 ` ahesford
2020-07-20 23:39 ` ericonr
2020-07-20 23:43 ` ericonr
2020-07-21  0:12 ` sgn
2020-07-21  0:12 ` sgn
2020-07-21  0:16 ` sgn
2020-07-21  0:17 ` ahesford
2020-07-21  0:27 ` ericonr
2020-07-21  1:05 ` sgn
2020-07-21  1:12 ` ericonr
2020-07-21  1:21 ` ericonr
2020-07-21  1:23 ` [PR PATCH] [Updated] " ericonr
2020-07-21  1:24 ` ericonr
2020-07-27 11:56 ` sgn
2020-07-27 12:39 ` ericonr
2020-07-27 12:49 ` [PR REVIEW] " sgn
2020-07-27 12:49 ` sgn
2020-07-27 12:51 ` [PR PATCH] [Updated] " ericonr
2020-07-27 12:52 ` [PR REVIEW] " ericonr
2020-07-27 12:52 ` [PR PATCH] [Updated] " ericonr
2020-07-27 12:53 ` sgn
2020-07-27 12:54 ` sgn
2020-07-27 12:56 ` sgn
2020-07-27 12:58 ` ericonr
2020-07-27 13:04 ` sgn
2020-07-27 13:09 ` ericonr
2020-07-27 13:18 ` [PR PATCH] [Updated] " ericonr
2020-07-27 13:19 ` ericonr
2020-07-27 13:20 ` [PR PATCH] [Updated] " ericonr
2020-07-27 13:25 ` sgn
2020-07-27 13:28 ` ericonr
2020-07-27 13:29 ` ericonr
2020-07-27 13:36 ` [PR REVIEW] " ahesford
2020-07-27 13:36 ` ahesford
2021-07-07 21:24 ` jirutka
2021-07-07 21:55 ` ahesford
2021-07-07 22:47 ` jirutka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).