Tuesday, December 24, 2019

14.04 - list all the ppa repositories added to my system


How can I list all the ppa repositories added to my system and save it to a .txt file, so that I don't want to spend my time in searching for ppa's for fresh installations and i can just select a ppa line in my .txt file and append to the command sudo add-apt-repository? Also is there any other ways to do this in which i dont want to give the gpg keys manually?



From How can I get a list of all repositories and PPAs from the command line into an install script?


Part of the answer looks to have what you are looking for:


#! /bin/sh
# listppa Script to get all the PPA installed on a system ready to share for reininstall
for APT in `find /etc/apt/ -name \*.list`; do
grep -o "^deb http://ppa.launchpad.net/[a-z0-9\-]\+/[a-z0-9\-]\+" $APT | while read ENTRY ; do
USER=`echo $ENTRY | cut -d/ -f4`
PPA=`echo $ENTRY | cut -d/ -f5`
echo sudo apt-add-repository ppa:$USER/$PPA
done
done

Save this as listppa.sh


listppa.sh > installppa.sh

This creates a script that you can backup somewhere, then run to add your PPAs on a fresh install by simply running:


installppa.sh

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...