Last active
January 3, 2021 05:15
-
-
Save danielfullmer/a582fa467a681f69a27ae88b6168f95d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
BUILT=$1 | |
UPSTREAM=$2 | |
cd "$BUILT" | |
check_partition() { | |
local partition=$1 | |
while read -r lib; do | |
libdir=$( (readelf -h "$lib" | grep -q ELF64) && echo lib64 || echo lib ) | |
while read -r required_lib; do | |
if [[ ! (-f "$BUILT/$partition/$libdir/$required_lib" || -L "$BUILT/$partition/$libdir/$required_lib" ) && -e "$UPSTREAM/$partition/$libdir/$required_lib" ]]; then | |
echo "$partition/$libdir/$required_lib is needed by $lib" | |
fi | |
done < <(readelf -d "$lib" | grep NEEDED | tr -s ' ' | cut -d ' ' -f6 | tr -d '[]') | |
done < <(find "$partition" -type f -name '*.so') | |
} | |
check_partition "system_ext" | |
check_partition "vendor" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment