Subiquity snap doesn't stage language-selector-common nor locales
packages.
Attempting to run those commands require respecting the env previously
prepared by the caller, as well as fixing the commands paths
(or changing the PATH env var in the env preparation step).
Since the apt commands were already ran with a fixed path,
I'm applying the same principle in here.
Yet, for now, Jammy doesn't ship the l-s-c package seeded,
so a condition was preserved to avoid future crashes.
(cherry picked from commit 2e67005403)
UDI snap ships the package, thus its data dir is part of the snap
subiquity snap does not.
This tries l-s-c data dir in the base system, outside of the snap
and gives up if the dir does not exits.
(cherry picked from commit 1105da2368)
create_task has the following note:
Important: Save a reference to the result of this function, to avoid a
task disappearing mid-execution.
Convert existing usage of create_task to run_bg_task, if that
create_task is not actually storing the result.
Recent changes in GUI turned possible to have that field as None,
leading to a crash.
This avoids the crash while preserving the default behavior of
installing the language packs.
That variant would only apply configs if in autoinstall.
There are no more screens available related to those settings in
wsl_setup.
Reconfiguration variant is the only one able to write that file.
to the WSLSetupOptions controller.
Misuse of the default_loader().
That's meant for loading /etc/wsl.conf.
WSLSetupOptions is by design not related to that config file.
With the plan to call curtin multiple times where each invocation has a
specific purpose, we want the client to have a simple way to monitor the
status of the installation.
Instead of defining new application states for each stage, we will
report the more generic WAITING / RUNNING states in a loop until we get
to the final stages of the installation.
To start with, we are dropping POST_WAIT and POST_RUNNING in favor or
WAITING and RUNNING.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
lang-packs post-install hook executes locale-gen.
For certain languages a matrix of locales is generated.
Re-running locale-gen regenerates not only the locale we wanted,
but the whole matrix, causing further delays.
We can save up to 40s (tested on my laptop) by skipping locale-gen if
apt succeeded.
Still useful to run it unconditionally i dry-run since apt won't execute
any post-install hook.
update requires root access to the machine and there is no --simulate
option so skip it in dry-run mode.
Co-authored-by: Didier Roche <didrocks@ubuntu.com>
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 this controller
to interpret it as '/' if not properly set, thus discarding the '.'.
It seemed far too much complicated find the proper way to deal with
apt Python library under the snap environment.
Opted for running the system apt command without the LD_*
customisations, similar to what an installer does when chroot into the
taget system.
This allows for running subprocess outside of the snap environment.
Both functions now receive a custom env without the LD_ related vars.
Renamed _create_user() to create_user() to make explicit that it has the
same semantic level as apply_locale().
Grow a new API for enabling/disabling systemd experimental support. We
do this by chaining a specific command= in the boot section.
We preserve the user customized command= content when systemd
experimental support is not enabled.
Co-authored-by: Jean-Baptiste Lallement <jean-baptiste@ubuntu.com>
Tests in real WSL2 environment revealed that update-locale checks fails but with the "--no-checks" option it updates the locale files accordingly and when the image restarts the locale is correctly set.
Also, splits part of the configure() method:
- `__query_uid()` finds the username UID
- `_create_user()` creates the user set in IdentityModel
- Both methods accept a fake root path under dryrun.
The check-language-support on my machine was providing a single empty
newline as output, and the length check isn't catching that as the
resulting packages array has a value of [''].
Drop empty values from the list to avoid a "KeyError: ''" exception.