Skip to content

Instantly share code, notes, and snippets.

@i80and
Last active March 30, 2017 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i80and/5258304a693895c3e3fc to your computer and use it in GitHub Desktop.
Save i80and/5258304a693895c3e3fc to your computer and use it in GitHub Desktop.
Extracts the RPM package dependencies for a directory of executables, prefering 64-bit
getdeps_rpm() {
for dep in $(readelf -d ./* | grep NEEDED | awk '{print $5}' | cut -c 2- | rev | cut -c 2- | rev | sort | uniq); do
rpm -qf "/usr/lib64/${dep}" 2>/dev/null || rpm -qf "/lib64/${dep}" 2>/dev/null || rpm -qf "/usr/lib/${dep}" 2>/dev/null || rpm -qf "/lib/${dep}"
done | sort | uniq | rev | cut -d - -f 1-2 --complement | rev
}
getdeps_deb() {
for f in $(readelf -d ./* | grep NEEDED | awk '{print $5}' | cut -c 2- | rev | cut -c 2- | rev | sort | uniq); do
apt-file search "$f"
done | cut -d ':' -f 1 | sort | uniq
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment