Is there a way to automatically delete or disable a ppa that does not work anymore?
When I do apt-get update
I get a lot of error message regarding some ppas that cant be found.
I have disabled them by hand for now, but is there a way to disable them automatically? Since I have many ppas it is a lot of work to search and disable them by hand.
Best Answer
You can use a script to disable/enable a ppa very easily. Save the script as
toggle_ppa.sh
and put it in/usr/local/bin
Usage
Example
How it works
When any ppa repo is deactivated using Software center (GUI), it actually puts a
#
in front of all the lines inside corresponding ppa.list
file at/etc/apt/sources.list.d/
. Usually most of the.list
files contain two lines that begins withdeb http
anddeb-src
, a few have only one. The above script is doing the same thing usingsed
. First it checks the ppa.list
(input by user) is present or not. Then put or remove a#
in front the lines accordingly.The code acts in a very interactive manner. When someone runs this along with ppa name as its argument, it will display the PPA's current status and what the code is going to do on successful execution. Then it will ask permission of the user. Only if the user inputs
'y'
to confirm the code will change the status of the PPA and activate/deactivate it. It will immediately abort if the user puts an'n'
for no.Note I proposed this code in this answered. glutanimate helped a lot to improve the code.