I need to list/download all the recursive dependencies of a debian package.
Suppose i need to install package a.deb and it depends on package b.deb and again package b.d
You can use apt-rdepends
for getting all the dependencies for a package recursively. And by piping the result to grep you can have only the package names and omit unneeded information.
Example:
$ apt-rdepends cowsay | grep -E '^[a-zA-Z0-9]'
Output:
cowsay
perl
libbz2-1.0
libc6
libgcc1
gcc-4.9-base
multiarch-support
libdb5.3
libgdbm3
dpkg
liblzma5
libselinux1
libpcre3
tar
libacl1
libattr1
zlib1g
install-info
perl-base
perl-modules
You can then download those packages using apt-get download $package
and install them offline on your machine.
By default, apt
installs Recommends, so you might want to run apt-rdepends
like so:
apt-rdepends -f Depends,PreDepends,Recommends -s Depends,PreDepends,Recommends cowsay
Since apt-rdepends
by default follows and shows only Depends, PreDepends.