Created
March 2, 2022 06:02
-
-
Save stellarpower/8eadf14dd09642606d809de110b6163d to your computer and use it in GitHub Desktop.
Find Debian Packages for Library Dependencies for a Given Binary
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 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