Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck a list of packages to install with apt-get
    primarykey
    data
    text
    <p>I am writing a post-install script for Ubuntu in Perl (same script as seen <a href="https://stackoverflow.com/questions/3875715/how-can-i-run-a-perl-script-as-root-yet-still-affect-user-gconf-settings">here</a>). One of the steps is to install a list of packages. The problem is that if <code>apt-get install</code> fails in some of many different ways for any one of the packages the script dies badly. I would like to prevent that from happening.</p> <p>This happens because of the ways that <code>apt-get install</code> fails for packages that it doesn't like. For example when I try to install a nonsense word (i.e. typed in the wrong package name) </p> <pre><code>$ sudo apt-get install oblihbyvl Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package oblihbyvl </code></pre> <p>but if instead the package name has been obsoleted (installing handbrake from ppa)</p> <pre><code>$ sudo apt-get install handbrake Reading package lists... Done Building dependency tree Reading state information... Done Package handbrake is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'handbrake' has no installation candidate $ apt-cache search handbrake handbrake-cli - versatile DVD ripper and video transcoder - command line handbrake-gtk - versatile DVD ripper and video transcoder - GTK GUI </code></pre> <p>etc, etc ...</p> <p>I have tried parsing the results of <code>apt-cache</code> and <code>apt-get -s install</code> to try to catch all possibilities before doing the install, but I seem to keep finding new ways to allow failures to continue to the actual install system command.</p> <p>My question is, is there some facility either in Perl (e.g. a module, though I would like to avoid installing modules if possible as this is supposed to be the first thing run after a new install of Ubuntu) or apt-* or dpkg that would let me be sure that the packages are all available to be installed before installing and if not fail gracefully in some way that lets the user decide what to do? </p> <p>N.B. I am doing something along the lines of:</p> <pre><code>my @list_of_install_candidates = (...); my @to_install = grep { my $output = qx{ apt-get -s install $_ }; parse_output($output); } @list_of_install_candidates; system('apt-get', 'install', @to_install); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload