Return to Snippet

Revision: 20050
at November 5, 2009 10:46 by xxtjaxx


Initial Code
#! /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

Initial URL

                                

Initial Description
You can use this snippet to get the packages your application depends on in a debian distro. Quite usefull when you are a new debian package maintainer and want to package a pretty highlevel c++ binary

Initial Title
get debian packages for linked libraries in an executable

Initial Tags

                                

Initial Language
Bash