Merge pull request #1258 from CarlosNihelton/fix-snap-path

Ensures snap_dir='/' if not better specified.
This commit is contained in:
Didier Roche 2022-04-07 09:06:15 +02:00 committed by GitHub
commit 3deddf76ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -145,6 +145,13 @@ class ConfigureController(SubiquityController):
packages = []
# Running that command doesn't require root.
snap_dir = os.getenv("SNAP", default="/")
# UDI sets the SNAP env var to '.' for development purposes.
# See:
# https://github.com/canonical/ubuntu-desktop-installer/commit/9eb6f04
# It is unlikely that under test or production that env var will
# ever by just '.'. On the other hand in dry-run we want it pointing to
# '/' if not properly set.
snap_dir = snap_dir if snap_dir != '.' else '/'
data_dir = os.path.join(snap_dir, "usr/share/language-selector")
if not os.path.exists(data_dir):
log.error("Misconfigured snap environment pointed L-S-C data dir"