I am working on generating some auto install scripts that would work on different versions of Ubuntu. Therefore, I try to keep the
add-apt-repository statements generic as seen below.
add-apt-repository -y "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
add-apt-repository -y ppa:graphics-drivers
However, as some repos don’t exist for certain versions, auto generated urls might lead to errors like below.
Err:22 http://ppa.launchpad.net/wireshark-dev/stable/ubuntu disco Release 404 Not Found [IP: 22.214.171.124 80] E: The repository 'http://ppa.launchpad.net/wireshark-dev/stable/ubuntu disco Release' does not have a Release file. N: Updating from such a repository can't be done securely, an is therefore disabled by default.
I know that this can’t be kept 100% flexible across all versions without keeping
ubuntu version vs package repo lookup tables/if-else statements. However, for my simple purposes, it is enough to know if any given url/ppa is valid or not.
So, is there a way to test this without adding the url/ppa and seeing it to fail on next