How to see if a ppa supports my distro

Solution 1:

Update:

The script now checks if the ppa supports your distro, and then aks for confirmation if you want to add the repo to your sources list and only then installs the packages.

Use this at your own risk! I only tested this on two ppa's! I will not be held responsible for broken packages!

code:

#!/bin/bash


#-----------------------------------------------
#   Author      :   Imri Paloja
#   Email       :   ****.******@*****.***
#   HomePage    :   www.eurobytes.nl
#   Version     :   3.0
#   Name        :   add-ppa
#----------------------------------------------- 

# CHANGELOG
# 
# 1. Asks for confirmation if ppa supports distro.

mkdir /tmp/add-ppa/

wget --quiet "http://ppa.launchpad.net/$(echo $1 | sed -e 's/ppa://g')/ubuntu/dists" -O /tmp/add-ppa/support.html

grep "$(lsb_release -sc)" "/tmp/add-ppa/support.html" >> /tmp/add-ppa/found.txt

cat /tmp/add-ppa/found.txt | sed 's|</b>|-|g' | sed 's|<[^>]*>||g' >> /tmp/add-ppa/stripped_file.txt

if [[ -s /tmp/add-ppa/stripped_file.txt ]] ; then

echo "$(lsb_release -sc) is supported"


read -p "Do you wish to install add the ppa to your source, and install the binaries [y/n] ?"
if [ "$REPLY" == "y" ] ; then

echo "Adding it to your sources list"
sudo add-apt-repository $1

echo "Refreshing your sources list"
sudo apt-get update 

# Searching for the needed files, and installing them

wget --quiet "http://ppa.launchpad.net/$(echo $1 | sed -e 's/ppa://g')/ubuntu/dists/$(lsb_release -sc)/main/binary-amd64/Packages" -O /tmp/add-ppa/packages.html

grep "Package:" "/tmp/add-ppa/packages.html" >> /tmp/add-ppa/packages.txt

cat /tmp/add-ppa/packages.txt | sed ':a;N;$!ba;s/\n/ /g' >> /tmp/add-ppa/packages_stripped_file.txt

cat /tmp/add-ppa/packages_stripped_file.txt | sed 's|Package:||g' >> /tmp/add-ppa/packages_stripped_file2.txt

sudo apt-get install $(grep -vE "^\s*#" /tmp/add-ppa/packages_stripped_file2.txt  | tr "\n" " ")

else
 exit 0
fi

else

echo "$(lsb_release -sc) is not supported"

fi;

#Cleanup

rm -r /tmp/add-ppa/

usage:

None supported ppa's

./support.sh ppa:m-gehre/ppa
saucy is not supported

supported ppa's

./support.sh ppa:banshee-team/ppa
saucy is supported
Do you wish to add the ppa to your sources list, and install the binaries [y/n] ??

Adding it to your sources list
...
Refreshing your sources list
...
sudo apt-get install
....

See the script in action:

  • Automatic ppa checker and adder - YouTube
  • gist.github.com: blade1989 - add-ppa
    • For a more up to date script, check the gist link

Improved it. Original answer by Wilf

Solution 2:

A bash script to try a PPA for your distribution :

I just learned some bash for you haha. This works great, I'm proud (and thanks to Wilf for his answer)

#!/bin/bash
# usage : bash myscript ppa:something/something

# get list of ppa's supported distribution
wget http://ppa.launchpad.net/$(echo $1 | sed -e 's/ppa://g')/ubuntu/dists -O /tmp/test-ppa.tmp -q

# check if your release is in the downloaded list
RELEASE=`cat /tmp/test-ppa.tmp | grep $(lsb_release -sc)`
if [[ -n "$RELEASE" ]] ; then 
    echo "$1 will work with $(lsb_release -si) $(lsb_release -sr) $(lsb_release -sc)"
else 
    echo "$1 won't work with $(lsb_release -si) $(lsb_release -sr) $(lsb_release -sc)"
fi

# cleaning
rm /tmp/test-ppa.tmp

Usage :

1) Copy this in a text file somewhere (in the example below it's ~/myscript)

2) Use the command :

bash myscript ppa:something/something 

Note : you can also copy that script in /usr/bin/ folder with sudo cp ~/myscript /usr/bin/ppa-test && sudo chmod +x /usr/bin/ppa-test to use directly in command-lines :

ppa-test ppa:something/something


Example :

(here I used : ppa:libreoffice/ppa with ~/myscript)

ppa-check

Edit: updated with blade19899's idea of using lsb_release

Solution 3:

I ain't tested it, but a script like this should work:

#!/bin/bash
echo "http://ppa.launchpad.net/$(echo $1 | sed -e 's/ppa://g')/ubuntu/dists"

You have to run this as ./SCRIPTNAME ppa:WHATEVER/WHATEVER - this one liner also works, but you have insert the PPA name (where ppa:gnome3-team/gnome3 is):

echo "http://ppa.launchpad.net/$(echo ppa:gnome3-team/gnome3 | sed -e 's/ppa://g')/ubuntu/dists"

You can then open the link in terminal (some terminals automatically show clickable links), or run it with curl to download it as text. It should just show the list of folders for the supported releases for the ppa.

I recently added a ppa, so I looked at that plus the Software and Updates thing and made a guess...

Solution 4:

Well I might have a GUI solution for you! The best way for me is PPA Manager:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager

when you added ppa or ppas already added in your system, open PPA Manager and click manage ppas it will take you to new window with a list of ppas in your system click on any ppa and choose list packages below, if there be any packages available it will list if not you can delete it. Worked for me even yesterday I had ppa for Saucy and Trusty so list packages showed me "0" and I removed it :)