Ubuntu: Check dependencies and generate download script before installing by dpkg [duplicate]



Question:

This question already has an answer here:

I used to install packages with dpkg -i *.deb command for off-line installation. Because all deb files are in one folder.

I want to avoid dependency error and stop installing packages as broken.

Ultimately my aim is to check dependencies and generate download script (if all dependencies are not satisfied) for only those package which is missing in mentioned folder. so-that I can first download missing packages and Then confidently install package by dpkg -i *.deb

apt-cache showpkg $(find -iname '*.deb' -exec dpkg --info '{}' \; | awk '/Package:/ {print $2}') shows dependencies but long list and not helpful to check whethter it is satisfied (exist) in mentioned folder or not. Also dpkg -I *.deb errors following:

   dpkg-deb: 'cabextract_1.4-4_i386.deb' contains no control component 'chromium-codecs-ffmpeg-extra_34.0.1847.116-0ubuntu2_i386.deb'     dpkg-deb: 'cabextract_1.4-4_i386.deb' contains no control component 'flashplugin-installer_11.2.202.350ubuntu1_i386.deb'  ..  ..  so on for each deb  

Hence, That commands are not useful for me.

Further Clarification:

  1. First check all deb dependencies in my folder.
  2. according to package already installed, check this deb's are able to installed without dependency error or not.
  3. if yes then execute dpkg -i *.deb
  4. else list missing package which not fond installed or in mentioned folder

Thanks.


Solution:1

You can always try a dry run before the install,

dpkg --dry-run -i *.deb  


Solution:2

You can get a list of the packages dependencies with:

find *deb -exec dpkg -f {} Depends \;  


Solution:3

You can also try one of these

 dpkg -I package   apt-cache rdepends package.deb   apt-cache showpkg package-name  

this one is a combination of steps incase it's just a .deb file

 ar -x <package-name>.deb   tar -xzf control.tar.gz   grep Depends control  

or

 apt-cache depends package-name  

for example

 apt-cache depends mplayer  

but i think the last option is what might serve you best


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »