After adding some PPAs from Launchpad to my repositiory (add-apt-repository
) I want to install them automatically. As far as I know there is no command to install all new PPAs after apt-get update
. And I can't run a script installing all new PPAs manually, because the install name of some PPAs differ to the name they have on the launchpad website/API.
1 Answer
I understand you want to add a PPA to your system and automatically install all packages for your release and architecture that it provides.
Disclaimer: I am absolutely unsure if what you want to do is a good idea. But if you're truly insistent and proceed with caution, be my guest.
The lists of packages that can be installed from a repository are downloaded and stored in
/var/lib/apt/lists/
when apt-get update
runs.
Those list files contain in plain text basically the information displayed when you do apt-cache show <package>
. In particular each package has a field Package: <name-of-package>
Find here a Python script, that extracts all those Package
fields and strings the package names together. Save it as whatever.py
and run as ./whatever.py <packagelist>
. It will print the appropriate apt-get install
command, but does not execute it (it couldn't because you're not running this as root, are you...?). This is up to you, and I strongly suggest you try with -s
(simulate) first!
#!/usr/bin/env python
import sys
import re
if len(sys.argv)<2:
print "Usage: "+sys.argv[0]+" PACKAGELIST"
quit()
try:
packages = []
infile = open(sys.argv[1],'r')
for line in infile:
p = re.match(r"Package: (\S+)", line)
if p:
packages.append(p.group(1))
infile.close()
print "apt-get install -s "+" ".join(packages)
except IOError:
print "File "+sys.argv[1]+" not found."
For example:
If this produces truly the result you desire depends on the PPA and the packages in there.
Use at your own risk.
sudo apt-get upgrade
to install newer versions of already installed packages.add-apt-repository ppa
2.apt-get update
3.install ppa
. But the name which is necessary for the install command can differ from the name given on the launchpad site. That's why a automatic installation of a PPA is not always possible. clear?