Write text files instead of wget

This commit is contained in:
Carlos Nihelton 2021-11-09 18:15:20 -03:00
parent 4e050ecddb
commit 63d565b89c
1 changed files with 7 additions and 3 deletions

View File

@ -145,11 +145,15 @@ class ConfigureController(SubiquityController):
apt_pkg.config
.find_dir("Dir::Cache::Archives")[1:])
os.makedirs(packs_dir, exist_ok=True)
try:
for package in packages:
# Downloading instead of installing. Doesn't require root.
# Just write the package uri to a file instead of installing.
archive = os.path.join(packs_dir, cache[package].fullname)
cmd = ["wget", "-O", archive, cache[package].candidate.uri]
await arun_command(cmd, env=env)
with open(archive, "wt") as f:
f.write(cache[package].candidate.uri)
except IOError:
log.error("Failed to write %s file.", archive)
return False
return True