I use a couple of third party launchpad ppa repositories (mercurial, tortoisehg, medibuntu, etc.). I was wondering if there was a way (preferable a script) that would allow me to back up the ppa's and then later restore them? This would be very handy after a clean install of my system. Currently I can backup my package listing through synaptic but I can't restore it because I have to have the ppa's in place first.

asked 16 May '10, 11:54

Troy's gravatar image

Troy
122510
accept rate: 100%

It would be great if you could accept the answer that mostly fit to you. It gives you and the answering person reputation points. See the FAQ for details.

(13 Jul '10, 12:27) guerda

Please accept an answer, or provide more details so we can help.

(14 Jun '11, 11:41) rfelsburg ♦



I ended up writing a small shell script that uses:

sudo add-apt-repository ppa:<repository-name>

The information was from here. For this to work you need to install:

sudo apt-get install python-software-properties

After a clean install I'll be able to run the shell script and the ppa's that I use will be updated.

link

answered 17 May '10, 12:07

Troy's gravatar image

Troy
122510
accept rate: 100%

If you use the command add-apt-repository, all your custom ppa are added to the folder /etc/apt/sources.list.d/.

It contains all information for this ppa. So just back up this folder, restore it and you're done:

  1. tar -cvjf mysweetppas.tar.bz2 /etc/apt/sources.list.d/
  2. sudo tar -xvjf mysweetppas
  3. sudo apt-get update

To re-use the ppa you defined in /etc/apt/sources.list, you can do the following as root (!):

  1. cp /etc/apt/sources.list /media/[your external drive]/
  2. cat /media/[your external drive]/sources.list >> /etc/apt/sources.list
  3. apt-get update

Note that you will have duplicates in your sources list! So review it before installing new software!

Good luck!

link

answered 17 May '10, 13:09

guerda's gravatar image

guerda
5533515
accept rate: 38%

edited 20 May '10, 06:43

That looks interesting. I'll have to try it out

(18 May '10, 01:22) Troy

Just copy the /etc/apt/sources.list file to a location, then after install copy it back and you will have all your ppa's referenced.

cp /etc/apt/sources.list /media/{external_device}

A lot easier than re-adding the PPA's after. This also has the advantage that it will also retain any additional, non-launchpad repositories you may have added.

link

answered 19 May '10, 11:20

Gareth's gravatar image

Gareth
231115
accept rate: 62%

How would this work for a new version of the operating system. I upgraded from Ubuntu Karmic to Lucid and there are ppas for both karmic and lucid in sources.list.d. I had to add the ppa's again after the upgrade. I imagine if I copied my backup, I would still have to add the ppa's. Is there a way around this?

(19 May '10, 12:29) Troy

I would suggest learning and using PERL. I'm not good enough to tell you off the top of my head, but scripts that do similar things as you ask are available online and can be modified to suit. I'm learning this useful tool (PERL) myself -- not so much because I want to, but because it makes life easier.

link

answered 21 May '10, 12:29

hilyard's gravatar image

hilyard
912
accept rate: 0%

Any language would work well. I would probably write this in python.

(22 May '10, 11:36) Troy
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×81
×10
×1

Asked: 16 May '10, 11:54

Seen: 4,829 times

Last updated: 14 Jun '11, 11:41

powered by OSQA