commit:     bdf7f9e549314ffd69a8dfbe41f1d5ecd86cc99d
Author:     Dmitry Baranov <reagentoo <AT> gmail <DOT> com>
AuthorDate: Sat Sep  9 10:20:20 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 28 01:58:52 2023 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=bdf7f9e5

gen_moddeps.sh: don't use echo/printf inside the cycle

Also prevent printing empty line if mydeps column is null.

Signed-off-by: Dmitry Baranov <reagentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gen_moddeps.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gen_moddeps.sh b/gen_moddeps.sh
index f175b72..6915746 100755
--- a/gen_moddeps.sh
+++ b/gen_moddeps.sh
@@ -18,7 +18,7 @@ gen_dep_list() {
                cat "${moddir}/modules.builtin"
                cat "${moddir}/modules.order"
        else
-               local -a modlist=()
+               local -a modlist=() moddeplist=()
 
                local mygroups
                for mygroups in ${!MODULES_*} GK_INITRAMFS_ADDITIONAL_KMODULES
@@ -44,8 +44,7 @@ gen_dep_list() {
                local mydeps mymod
                while IFS=" " read -r -u 3 mymod mydeps
                do
-                       echo ${mymod%:}
-                       printf '%s\n' ${mydeps}
+                       moddeplist+=( ${mymod%:} ${mydeps} )
                done 3< <(
                        local -a rxargs=( "${modlist[@]}" )
 
@@ -59,5 +58,7 @@ gen_dep_list() {
                        cat "${moddir}/modules.dep" \
                                | grep -F "${rxargs[@]}"
                )
+
+               printf '%s\n' "${moddeplist[@]}"
        fi | xargs basename -s "${KEXT}" | sort | uniq
 }

Reply via email to