commit:     18060700a1801a7b2bd9d46eccd06f01cdc2ef5c
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 12 21:51:17 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Jan 12 22:09:32 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=18060700

gen_funcs.sh: find_kernel_binary() refactored

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_funcs.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gen_funcs.sh b/gen_funcs.sh
index a19cb88..821f150 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -1846,21 +1846,24 @@ expand_file() {
 }
 
 find_kernel_binary() {
-       local kernel_binary=$*
-       local curdir=$(pwd)
+       local kernel_binary=${*}
+       local kernel_binary_found=
 
-       cd "${KERNEL_OUTPUTDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
+       pushd "${KERNEL_OUTPUTDIR}" &>/dev/null || gen_die "Failed to chdir to 
'${KERNEL_OUTPUTDIR}'!"
+
+       local i
        for i in ${kernel_binary}
        do
                if [ -e "${i}" ]
                then
-                       tmp_kernel_binary=${i}
+                       kernel_binary_found=${i}
                        break
                fi
        done
 
-       cd "${curdir}" || gen_die "Failed to chdir to '${TDIR}'!"
-       echo "${tmp_kernel_binary}"
+       popd &>/dev/null || gen_die "Failed to chdir!"
+
+       echo "${kernel_binary_found}"
 }
 
 kconfig_get_opt() {

Reply via email to