How can I backup my PPAs?

Well because I like mucking around with command line scripting, I've written the following. It generates a list of PPA strings that you could backup and then script into add-apt-repository:

grep -RoPish '(?<=ppa.launchpad.net/)[^/]+/[^/ ]+' /etc/apt | sort -u | sed 's/^/ppa:/'

That'll generate something like:

ppa:ubuntu-wine/ppa
ppa:am-monkeyd/nautilus-elementary-ppa
ppa:nilarimogard/webupd8
ppa:ubuntu-x-swat/x-updates
ppa:tualatrix/ppa
ppa:banshee-team/banshee-unstable
ppa:chromium-daily/beta
ppa:libreoffice/ppa
ppa:banshee-team/ppa

If you ever wanted to blanket-restore those, you could pipe them back into the system like so (assuming we saved the PPAs to ~/ppa-backup.txt:

<~/ppa-backup.txt xargs -I % sudo add-apt-repository %

I would probably suggest you don't just restore them all. Look through the backup and make sure you know what each PPA contains.


What I do is that I copy the whole /etc/apt directory to a safe place. If you have to reinstall or clone your install, just copy back that directory. It'll save even the gpg trusted keys.


If importing all the GPG keys is what you're looking for, you can use my script (comes in a .deb) to import all missing GPG keys at once. Download

To use, simply run:

sudo launchpad-getkeys

You can take a look inside the .deb if you want, the script is really small and easy to understand (in case you don't trust my deb).

Then to back up all the PPAs, all you have to do is copy all the .list files on the new computer / new installation and once you've copied them, run the above command to import all the keys.

Tags:

Backup

Ppa