Check if multiple dependencies exist before installing a package in Debian or Ubuntu

The ideal tool for this is rmadison, which is a simple Perl script with few dependencies (the URI module and wget or curl), so it can run pretty much everywhere. It interrogates the Madison services hosted by Debian and Ubuntu to determine the availability of packages:

rmadison gcc-7

tells you which versions of GCC 7 are available in the various Debian suites,

rmadison -u ubuntu gcc-7

does the same for Ubuntu.

You can restrict the output to a specific version:

rmadison -u ubuntu -s bionic gcc-7

rmadison can search for both Debian and Ubuntu packages at the same time, and it also searches for packages in both End Of Life (12.04) and unreleased (18.10) Ubuntu versions. These are great features, but rmadison can't do partial keyword searching on my computer. Sometimes I can't remember the whole package name that I am searching for. I can only remember part of it, and the following instructions also work in this situation. Otherwise use rmadison which can be installed by the command sudo apt-get install devscripts in Ubuntu and Debian.

  1. Create a shell script to query if the multiple packages exist named Open-multiple-URLs-in-Firefox.sh. The script contains the following code:

    #!/bin/bash
    while read line; do
        firefox --new-tab "https://packages.ubuntu.com/$line"
    done < packages.txt
    
  2. Make the script executable.

    chmod +x Open-multiple-URLs-in-Firefox.sh
    
  3. Create a file named packages.txt that contains the names of all the required dependency packages, each package on a separate line. Save packages.txt in the same directory as Open-multiple-URLs-in-Firefox.sh.

  4. Run the script.

    ./Open-multiple-URLs-in-Firefox.sh  
    

The webpage that has information about each required dependency package will open in a separate tab in Firefox.

In order to search for multiple packages in Debian replace https://packages.ubuntu.com/ in the shell script with https://packages.debian.org/search?keywords=


This command is simpler alternative to the above shell script for use when you are only searching for 1 or 2 packages.

firefox --new-tab https://packages.ubuntu.com/first-package https://packages.ubuntu.com/next-package https://packages.ubuntu.com/last-package