Skip to content

Instantly share code, notes, and snippets.

@francislewis
Created April 1, 2015 21:15
Show Gist options
  • Save francislewis/f786713e031a1db5bb26 to your computer and use it in GitHub Desktop.
Save francislewis/f786713e031a1db5bb26 to your computer and use it in GitHub Desktop.
A script to show all ppas on current system
#! /bin/sh
# Script to get all the PPA installed on a system
for APT in `find /etc/apt/ -name \*.list`; do
grep -Po "(?<=^deb\s).*?(?=#|$)" $APT | while read ENTRY ; do
HOST=`echo $ENTRY | cut -d/ -f3`
USER=`echo $ENTRY | cut -d/ -f4`
PPA=`echo $ENTRY | cut -d/ -f5`
#echo sudo apt-add-repository ppa:$USER/$PPA
if [ "ppa.launchpad.net" = "$HOST" ]; then
echo sudo apt-add-repository ppa:$USER/$PPA
else
echo sudo apt-add-repository \'${ENTRY}\'
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment