Skip to content

Instantly share code, notes, and snippets.

@danielfullmer
Last active January 3, 2021 05:15
Show Gist options
  • Save danielfullmer/a582fa467a681f69a27ae88b6168f95d to your computer and use it in GitHub Desktop.
Save danielfullmer/a582fa467a681f69a27ae88b6168f95d to your computer and use it in GitHub Desktop.
#!/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