/ Published in: Bash
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
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#! /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