Skip to content

Instantly share code, notes, and snippets.

@dmmat
Created December 15, 2016 15:09
Show Gist options
  • Save dmmat/2b9a9aa02ec530420f2013c34ce75c17 to your computer and use it in GitHub Desktop.
Save dmmat/2b9a9aa02ec530420f2013c34ce75c17 to your computer and use it in GitHub Desktop.
Automated Removal of 404 Not found PPA's through script
#!/bin/bash
sudo rm /tmp/update.txt; tput setaf 6; echo "Initializing.. Please Wait"
sudo apt-get update >> /tmp/update.txt 2>&1; awk '( /E:/ && /launchpad/ && /404/ ) { print substr($5,26) }' /tmp/update.txt > /tmp/awk.txt; awk -F '/' '{ print $1"/"$2 }' /tmp/awk.txt > /tmp/awk1.txt; sort -u /tmp/awk1.txt > /tmp/awk2.txt
tput sgr0
if [ -s /tmp/awk2.txt ]
then
tput setaf 1
printf "PPA's going to be removed\n%s\n" "$(cat /tmp/awk2.txt)"
tput sgr0
while read -r line; do echo "sudo add-apt-repository -r ppa:$line"; done < /tmp/awk2.txt > out
bash out
else
tput setaf 1
echo "No PPA's to be removed"
tput sgr0
fi
@dmmat
Copy link
Author

dmmat commented Dec 15, 2016

sudo chmod +x ppa-remove

Copy and paste the ppa-remove file into /usr/bin directory.So that you can access it from anywhere.

sudo ppa-remove

tested on ubuntu 16.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment