switch-to-configuration-ng: prevent error during NIXOS_LUSTRATE install

This commit is contained in:
Jeff Huffman 2024-11-29 20:07:27 -05:00
parent 898c9e3c91
commit 4dd2fd7716
No known key found for this signature in database
GPG key ID: 7F1A93286A8960C7

View file

@ -970,10 +970,6 @@ fn do_system_switch(action: Action) -> anyhow::Result<()> {
std::env::set_var("LOCALE_ARCHIVE", locale_archive);
}
let current_system_bin = std::path::PathBuf::from("/run/current-system/sw/bin")
.canonicalize()
.context("/run/current-system/sw/bin is missing")?;
let os_release = parse_os_release().context("Failed to parse os-release")?;
let distro_id_re = Regex::new(format!("^\"?{}\"?$", distro_id).as_str())
@ -1033,6 +1029,11 @@ fn do_system_switch(action: Action) -> anyhow::Result<()> {
std::process::exit(0);
}
// Needs to be after the "boot" action exits, as this directory will not exist when doing a NIXOS_LUSTRATE install
let current_system_bin = std::path::PathBuf::from("/run/current-system/sw/bin")
.canonicalize()
.context("/run/current-system/sw/bin is missing")?;
let current_init_interface_version =
std::fs::read_to_string("/run/current-system/init-interface-version").unwrap_or_default();