3
from __future__ import print_function
9
# we need to blacklist linux-image-* as it does not install
10
# cleanly in the chroot (postinst failes)
11
blacklist = ["linux-image-","ltsp-client",
12
"glibc-doc-reference", "libpthread-dev",
13
"cman", "mysql-server", "fuse-utils",
14
"ltspfs", "gfs2-tools", "edubuntu-server",
15
"gnbd-client", "gnbd-server", "mysql-server-5.0",
16
"rgmanager", "clvm","redhat-cluster-suit",
17
# has a funny "can not be upgraded automatically" policy
20
"system-config-cluster", "gfs-tools"]
22
if name.startswith(b):
26
#apt_pkg.config.set("Dir::State::status","./empty")
29
group = apt_pkg.GetPkgActionGroup(cache._depcache)
30
#print([pkg.name for pkg in cache if pkg.is_installed])
34
for c in pkg.candidateOrigin:
35
if c.component == "main":
36
current = set([p.name for p in cache if p.marked_install])
37
if not (pkg.is_installed or blacklisted(pkg.name)):
39
new = set([p.name for p in cache if p.marked_install])
40
#if not pkg.markedInstall or len(new) < len(current):
41
if not (pkg.is_installed or pkg.marked_install):
42
print("Can't install: %s" % pkg.name)
43
if len(current-new) > 0:
44
troublemaker.add(pkg.name)
45
print("Installing '%s' caused removals_ %s" % (pkg.name, current - new))
47
#print(len(troublemaker))
48
for pkg in ["ubuntu-desktop", "ubuntu-minimal", "ubuntu-standard"]:
49
cache[pkg].mark_install()
51
# make sure we don't install blacklisted stuff
53
if blacklisted(pkg.name):
56
print("We can install:")
57
print(len([pkg.name for pkg in cache if pkg.marked_install]))
59
pm = apt_pkg.GetPackageManager(cache._depcache)
60
fetcher = apt_pkg.GetAcquire()
61
pm.GetArchives(fetcher, cache._list, cache._records)
62
print(apt_pkg.SizeToStr(fetcher.FetchNeeded))
63
print("Total space: ", apt_pkg.SizeToStr(cache._depcache.UsrSize))
68
while current < maxRetries:
70
res = cache.commit(apt.progress.text.AcquireProgress(),
71
apt.progress.base.InstallProgress())
73
# fetch failed, will be retried
75
print("Retrying to fetch: ", current)
77
except SystemError as e:
78
print("Error installing packages! ")
80
print("Install result: ", res)