I am trying to download some debian packages and their dependencies in a directory.
I tried using the command aptitude download <package_name> it downloaded the package without its dependencies.
How do I tell it to download the dependencies too?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You can use apt-rdepends to build the complete set of dependencies (recursively), including the main package, then download that:
apt-get download $(apt-rdepends "${package}" | grep -v ^ )
(replacing "${package}" of course).
Method 2
A rather hackish way to do that is to have another utility (apt-cache in this example) list the package’s dependencies:
# PACKAGE=nautilus; aptitude download $PACKAGE $(apt-cache depends "$PACKAGE" | grep Depends | awk -F ': ' '{print $NF}' | xargs)
Method 3
Easier Way
aptitude -d -o Dir::Cache:archives=/home/alex/aptitude-test/ install alsaplayer for exampel.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0