Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stellarpower/8eadf14dd09642606d809de110b6163d to your computer and use it in GitHub Desktop.
Save stellarpower/8eadf14dd09642606d809de110b6163d to your computer and use it in GitHub Desktop.
Find Debian Packages for Library Dependencies for a Given Binary
#!/usr/bin/env fish
set Directory (dirname (realpath (status -f) ) )
set ScriptName (basename (status -f))
set ScriptPath $Directory/$ScriptName
function fullPathLibraries -a pathToBinary
ldd $pathToBinary | grep '=>' | sd '.*=>\s*([^\s]+)\s+.*' '$1'
end
function main -a pathToBinary
for l in (fullPathLibraries $pathToBinary)
set package (dpkg -S $l 2>/dev/null)
dpkg-query --show (echo $package | sd '^([^\s]+):.*' '$1') 2>/dev/null
end
end
main $argv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment