Bug#1033921: debian-installer: Weekly build of d-i fails to find ipw2x00 firmware package
Control: tags -1 patch
On 07/04/2023 at 01:05, I wrote:
Ugly attached patch works for me as PoC.
Copy fd 0 into fd 9 (because it looked unused) before entering the
pipeline, and restore it when running install_firmware_pkg.
Here is another patch for hw-detect moving the install_firmware_pkg()
call outside the pipeline instead of playing with file descriptors.
PS: shouldn't this bug report be reassigned to hw-detect ?
From 5186662ea53ff694ba3fc841f623a521c9091d54 Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Mon, 17 Apr 2023 15:16:20 +0200
Subject: [PATCH] check-missing-firmware: Fix firmware license acceptance
The standard input of a command run within a pipeline is redirected,
which disrupts debconf. So move the install_firmware_pkg() call out
of the pipeline, else the debconf dialog is not displayed when the
firmware package preinst script requires a license acceptance.
---
check-missing-firmware.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
index 5db0e180..5ea194d7 100755
--- a/check-missing-firmware.sh
+++ b/check-missing-firmware.sh
@@ -318,18 +318,32 @@ install_firmware_pkg () {
# This does not use anna because debs can have arbitrary
# dependencies, which anna might try to install.
check_for_firmware() {
+ # any non-space character which is not a shell pattern meta-character * ? ! [ ]
+ # and cannot be part of a component name a-z - will do as a delimiter
+ local delim="^"
+ local list item dir fw_file fw_pkg_file component filename
+
echo "$files" | sed -e 's/ /\n/g' >/tmp/grepfor
for dir in $@; do
# An index file might exist, mapping firmware files to firmware
# packages, saving us from iterating over each firmware *.deb:
if [ -f $dir/Contents-firmware ]; then
log "lookup with $dir/Contents-firmware"
+ # environment modification in a pipeline is not persistent, so use stdout
+ list=$(\
grep -f /tmp/grepfor $dir/Contents-firmware | while read fw_file fw_pkg_file component; do
+ echo $fw_pkg_file$delim$component
+ done)
+ # do not call install_firmware_pkg() inside a pipeline because stdin is redirected,
+ # it disrupts debconf in the package preinst script if license agreement is required
+ for item in $(echo $list); do
+ fw_pkg_file=${item%$delim*}
# Don't install a package for each file it ships!
if grep -qs "^$fw_pkg_file$" /tmp/pkginstalled 2>/dev/null; then
continue
fi
if check_deb_arch "$dir/$fw_pkg_file"; then
+ component=${item##*$delim}
log "installing firmware package $dir/$fw_pkg_file ($component)"
install_firmware_pkg "$dir/$fw_pkg_file" "$component" || true
echo "$fw_pkg_file" >> /tmp/pkginstalled
--
2.30.2
Reply to: