Skip to content

Instantly share code, notes, and snippets.

@vampy
Created July 14, 2016 11:42
Show Gist options
  • Save vampy/09c1d57c6f834fef8d40cda36b8a5d75 to your computer and use it in GitHub Desktop.
Save vampy/09c1d57c6f834fef8d40cda36b8a5d75 to your computer and use it in GitHub Desktop.
Script to get all the PPA installed on a system
#!/bin/bash
# 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 ppa:$USER/$PPA
else
echo \'${ENTRY}\'
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment