[packages] Feature: skip if no internet.

Update documentation, add a new key *skip_if_no_internet* to support
systems that **recommend** having an internet connection (but don't
require it), and which also use the packages module. This prevents
a long delay while the package manager tries to access the internet
and times out (repeatedly).

Existing configurations are unchanged.
This commit is contained in:
Adriaan de Groot 2017-12-02 05:04:30 -05:00
parent 7b145c2a36
commit 150007c138
2 changed files with 19 additions and 3 deletions

View File

@ -426,6 +426,11 @@ def run():
else:
return "Bad backend", "backend=\"{}\"".format(backend)
skip_this = libcalamares.job.configuration.get("skip_if_no_internet", false)
if skip_this and not libcalamares.globalstorage.value("hasInternet"):
cDebug() << "WARNING: packages installation has been skipped: no internet";
return None
update_db = libcalamares.job.configuration.get("update_db", False)
if update_db and libcalamares.globalstorage.value("hasInternet"):
pkgman.update_db()

View File

@ -14,9 +14,20 @@
#
backend: dummy
# If set to true, a package-manager specific update procedure
# is run first (only if there is internet) to update the list
# of packages and dependencies.
# Often package installation needs an internet connection.
# Since you may allow system installation without a connection
# and want to offer **optional** package installation, it's
# possible to have no internet, yet have this packages module
# enabled in settings.
#
# You can skip the whole module when there is no internet
# by setting *skip_if_no_internet* to true.
#
# You can run a package-manager specific update procedure
# before installing packages (for instance, to update the
# list of packages and dependencies); this is done only if there
# is an internet connection. Set *update_db* to true to do so.
skip_if_no_internet: false
update_db: true
#