What's the best way to re-enable PPAs/repos after an upgrade?

When I upgrade from 11.10 to 12.04, what's the best way to re-enable my PPAs and added repositories?


Solution 1:

You need to add them all back/re-enabled them individually by uncommenting the lines in the files in the /etc/apt/sources.list.d/ directory.

Though upgrade time is a good time to reevaluate if you need the PPA in the first place if you were just using one to get a newer version of a package.

Solution 2:

I wrote a bash script that removes the leading hash character from all files in sources.list.d that were disabled during the upgrade.

The following code is for upgrading raring sources to saucy.

If you want to keep the suffix # disabled on upgrade to ..., use

for f in /etc/apt/sources.list.d/*.list; do sudo sed -i 's/raring/saucy/g' $f; sudo sed -i 's/^# \(.*disabled on upgrade to.*\)/\1/g' $f;done

if you want to delete the suffix # disabled on upgrade to ..., use

for f in /etc/apt/sources.list.d/*.list; do sudo sed -i 's/raring/saucy/g' $f; sudo sed -i 's/^# \(.*\) # disabled on upgrade to.*/\1/g' $f;done