Skip to content

Instantly share code, notes, and snippets.

@rm77
Created July 7, 2021 09:02
Show Gist options
  • Save rm77/1d48d91e74c1ae8069847eb1973fe9c0 to your computer and use it in GitHub Desktop.
Save rm77/1d48d91e74c1ae8069847eb1973fe9c0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#by greg minshall
needs=`readelf -d $1 | \
awk '$2=="(NEEDED)" {
gsub("[][]", "", $5);
hits[$5]=$5
}
END {
for (i in hits) {
printf(sprintf("%s ", i))
}
}'`
ldconfig -p | \
awk -vneeds="$needs" \
'BEGIN{
split(needs,aneeds)
}
{
if (!arr[$1])
arr[$1] = $NF
}
END {
for (i in aneeds) {
need = aneeds[i];
if (arr[need]) {
print need "\t" arr[need]
} else {
print "unfulfilled:", need
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment