Snippet Library

Browse | Submit A New Snippet | Create A Package

Get packages linked against a binary

Type:
Full Script
Category:
Searching
License:
GNU General Public License
Language:
Unix Shell
 
Description:
This snippet reads all linked libraries for a binary and finds matching library-packages in your current package-cache as well as their version in a debian/control file friendly format.

Versions Of This Snippet:

Snippet ID Download Version Date Posted Author Delete
271.02010-01-03 18:09Andreas Marschke

Download a raw-text version of this code by clicking on "Download Version"

 


Latest Snippet Version: 1.0

#! /bin/bash links=$(ldd $1 | cut -f2 | cut -d">" -f2 | cut -d"(" -f1) packages=$(dpkg -S $links 2>/dev/null | cut -d":" -f1) touch ./packages.txt for i in $packages do if [ ! "$(grep "$i" packages.txt)" ]; then version=$(apt-cache policy $i | grep "Installed:" | cut -d" " -f4) echo "$i (>= $version )" >> packages.txt fi done

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..

Powered By FusionForge
Show source