Add convenience member "num_homedirs" to the invocation structure, and initialize it when initializing homedirs. Rename sc_invocation_check_homedirs => sc_invocation_init_homedirs. Make sure mounts are bidirectionel.
The code in `sc_bootstrap_mount_namespace()` is not robust again
NULL values in sc_mount_config.dynamic_mounts and crashes in
`sc_create_mount_points()` and `sc_do_mounts()` when that
value is NULL.
This commit fixes the initial crash but it opens the question
if sc_create_mount_points() and sc_do_mounts() should also be
robust against NULL ?
Instead of mocking loadHomedirs in the happy case, make sure the code is exercised by letting it read the actual file instead.
Add additional check in TestConfigureHomedirsHappy to ensure mocks are called.
Rename sc_init_homedir_mounts => sc_homedir_mounts
Move the functionality of /var/lib/snapd/system-params to its own package with unit tests, to get a more structured approach to the file.
Let SetupSnapConfineSnippets itself discover the homedirs instead of passing it as a parameter, this is also more in line with how it already functions with existing features.
* snap: show log information from Wait tasks in the CLI
This is a tiny patch to make the UX on classic+modes systems
more user friendly. Right now when running e.g.
`snap refresh pc-kernel` there is no indication that a system
reboot is required to continue, the only visible output is
that a re-refresh is attempted.
To fix this properly a bigger change is required and various
attempts in PR#12417 are all having problems. However as a
very minimal improvement this commit shows log messages from
tasks in `Wait` state without changing anything else.
This means that the UX is more like:
```
$ snap refresh pc-kernel
2023-02-24T11:2315Z INFO Task set to wait until a manual system restart allows to continue
Handling re-refresh of "pc-kernel" as needed
```
while not ideal UX it feels like a worthwhile improvement until
we find the time to fix this properly.
* snap: fix typo
Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
* snap: add warning about pressing ctrl-c
* snap: tweak warning message when snaps are in "wait" state (thanks Samuele)
---------
Co-authored-by: Miguel Pires <miguelpires94@gmail.com>