Linux-Firmware Archive mirror
 help / color / mirror / Atom feed
From: mpagano@gentoo.org
To: linux-firmware@kernel.org
Cc: Mike Pagano <mpagano@gentoo.org>
Subject: [PATCH] copy-firmware.sh: Support passing in firmware files to install
Date: Sat, 23 Dec 2023 13:46:13 -0500	[thread overview]
Message-ID: <20231223184636.137246-1-mpagano@gentoo.org> (raw)

From: Mike Pagano <mpagano@gentoo.org>

This change adds support to copy-firmware.sh to accept a space separated
list of firmware files to install.

This allows our users to define a small subset of needed firmware files
their system requires without installing every firmware file included
from the repository.

Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
 copy-firmware.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/copy-firmware.sh b/copy-firmware.sh
index 6757c6ce..d954230d 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -50,6 +50,16 @@ while test $# -gt 0; do
             shift
             ;;
 
+        --firmware-list)
+            if [ -n "$2" ]; then
+                FIRMWARE_LIST=$2
+                shift 2
+            else
+                echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
+                exit 1
+            fi
+            ;;
+
         -*)
             if test "$compress" = "cat"; then
                 echo "ERROR: unknown command-line option: $1"
@@ -85,6 +95,7 @@ fi
 # shellcheck disable=SC2162 # file/folder name can include escaped symbols
 grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
     test -f "$f" || continue
+    [ -n "${FIRMWARE_LIST##*"$f"*}" ] && continue
     install -d "$destdir/$(dirname "$f")"
     $verbose "copying/compressing file $f$compext"
     if test "$compress" != "cat" && test "$k" = "RawFile"; then
@@ -107,6 +118,7 @@ fi
 
 # shellcheck disable=SC2162 # file/folder name can include escaped symbols
 grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
+    [ -n "${FIRMWARE_LIST##*"$f"*}" ] && continue
     if test -L "$f$compext"; then
         test -f "$destdir/$f$compext" && continue
         $verbose "copying link $f$compext"
-- 
2.41.0


                 reply	other threads:[~2023-12-23 18:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231223184636.137246-1-mpagano@gentoo.org \
    --to=mpagano@gentoo.org \
    --cc=linux-firmware@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).