Skip to content

Commit

Permalink
feat: read_elf_deps optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Skythrew committed Jul 12, 2023
1 parent 7d7c9e6 commit 01e3700
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/stmk/stmk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,20 @@ strip_files() {
read_elf_deps() {
cd $PKG
DEPS=()
READ_LIBS=()
for file in $(find);
do
FILETYPE=$(file $file | cut -d ' ' -f 2)
if [ "$FILETYPE" == "ELF" ]; then
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)
Expand All @@ -168,7 +175,6 @@ read_elf_deps() {
continue 2
fi
done

DEPS+=($PACKAGE_NAME)
fi
done
Expand Down

0 comments on commit 01e3700

Please sign in to comment.