1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-11 09:04:01 +03:00

init: Fix kexec condition in SwitchRoot

In #300 I "fixed" stage-0 by adding a switch to toggle between it being
enabled and disabled in the recovery menu. *That* works as expected.

In 2a46962d76 one can observe that the
`#will_kexec?` method will use data that will only come from the
`choice` made from the recovery interface. The `@use_generation_kernel`
member is not set at any other point.

With ruby semantics, this means that the `if` is false, so *unless* you
choose to boot using the recovery menu, it will never trigger `kexec`.

Why has this gone through this way? Most likely because my main testing
target was configured so it *always* went to the recovery menu at the
time, meaning that I never saw the default behaviour.
This commit is contained in:
Samuel Dionne-Riel 2022-07-31 16:03:32 -04:00
parent 3267d0b7a0
commit 5bd7e6bbfc

View File

@ -9,6 +9,10 @@ class Tasks::SwitchRoot < SingletonTask
add_dependency(:Task, Tasks::Splash.instance)
add_dependency(:Target, :SwitchRoot)
@target = SYSTEM_MOUNT_POINT
# By default, with stage-0, we prefer using the generation kernel
# This may be overriden by the user recovery user interface
@use_generation_kernel = STAGE == 0
end
# Given a path name, without the leading SYSTEM_MOUNT_POINT, resolves