/usr/share/auto-upgrade-tester/scripts/install_all_main is in auto-upgrade-tester 1:0.166.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | #! /usr/bin/python3
from __future__ import print_function
import apt
import apt_pkg
def blacklisted(name):
# we need to blacklist linux-image-* as it does not install
# cleanly in the chroot (postinst failes)
blacklist = ["linux-image-","ltsp-client",
"glibc-doc-reference", "libpthread-dev",
"cman", "mysql-server", "fuse-utils",
"ltspfs", "gfs2-tools", "edubuntu-server",
"gnbd-client", "gnbd-server", "mysql-server-5.0",
"rgmanager", "clvm","redhat-cluster-suit",
# has a funny "can not be upgraded automatically" policy
# see debian #368226
"quagga",
"system-config-cluster", "gfs-tools"]
for b in blacklist:
if name.startswith(b):
return True
return False
#apt_pkg.config.set("Dir::State::status","./empty")
cache = apt.Cache()
group = apt_pkg.ActionGroup(cache._depcache)
#print([pkg.name for pkg in cache if pkg.is_installed])
troublemaker = set()
for pkg in cache:
if not pkg.candidate:
continue
for c in pkg.candidate.origins:
if c.component == "main":
current = set([p.name for p in cache if p.marked_install])
if not (pkg.is_installed or blacklisted(pkg.name)):
pkg.mark_install()
new = set([p.name for p in cache if p.marked_install])
#if not pkg.marked_install or len(new) < len(current):
if not (pkg.is_installed or pkg.marked_install):
print("Can't install: %s" % pkg.name)
if len(current-new) > 0:
troublemaker.add(pkg.name)
print("Installing '%s' caused removals_ %s" % (pkg.name, current - new))
#print(len(troublemaker))
for pkg in ["ubuntu-desktop", "ubuntu-minimal", "ubuntu-standard"]:
cache[pkg].mark_install()
# make sure we don't install blacklisted stuff
for pkg in cache:
if blacklisted(pkg.name):
pkg.mark_keep()
print("We can install:")
print(len([pkg.name for pkg in cache if pkg.marked_install]))
print("Download: ")
pm = apt_pkg.PackageManager(cache._depcache)
fetcher = apt_pkg.Acquire()
pm.get_archives(fetcher, cache._list, cache._records)
print(apt_pkg.size_to_str(fetcher.fetch_needed))
print("Total space: ", apt_pkg.size_to_str(cache._depcache.usr_size))
res = False
current = 0
maxRetries = 3
while current < maxRetries:
try:
res = cache.commit(apt.progress.text.AcquireProgress(),
apt.progress.base.InstallProgress())
except IOError as e:
# fetch failed, will be retried
current += 1
print("Retrying to fetch: ", current)
continue
except SystemError as e:
print("Error installing packages! ")
print(e)
print("Install result: ", res)
break
|