From 01e3700365c398fd7b7732c315cc2cde012b6fed Mon Sep 17 00:00:00 2001 From: Skythrew Date: Wed, 12 Jul 2023 20:01:13 +0200 Subject: [PATCH] feat: read_elf_deps optimization --- scripts/stmk/stmk.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/stmk/stmk.sh b/scripts/stmk/stmk.sh index e8bc690..6122af2 100755 --- a/scripts/stmk/stmk.sh +++ b/scripts/stmk/stmk.sh @@ -147,6 +147,7 @@ strip_files() { read_elf_deps() { cd $PKG DEPS=() + READ_LIBS=() for file in $(find); do FILETYPE=$(file $file | cut -d ' ' -f 2) @@ -154,6 +155,12 @@ read_elf_deps() { ARCH=$(file $file | cut -d ' ' -f 3) LIBRARIES=$(readelf -d $file | grep 'NEEDED' | cut -d ':' -f 2 | cut -d '[' -f 2 | cut -d ']' -f 1) for library in $LIBRARIES; do + for lib in "${READ_LIBS[@]}"; do + if [ "$lib" == "$library" ]; then + continue 2 + fi + done + READ_LIBS+=($library) for package in /var/packages/*; do PACKAGE_NAME=$(basename $package) @@ -168,7 +175,6 @@ read_elf_deps() { continue 2 fi done - DEPS+=($PACKAGE_NAME) fi done