···
submitted_jobs: &Rc<RefCell<HashMap<dbus::Path<'static>, Job>>>,
while !submitted_jobs.borrow().is_empty() {
913
+
"waiting for submitted jobs to finish, still have {} job(s)",
914
+
submitted_jobs.borrow().len()
_ = conn.process(Duration::from_millis(500));
···
.restart_unit("nixos-activation.service", "replace")
.context("Failed to restart nixos-activation.service")?;
968
+
log::debug!("waiting for nixos activation to finish");
while !*nixos_activation_done.borrow() {
.process(Duration::from_secs(500))
···
/// Performs switch-to-configuration functionality for the entire system
fn do_system_switch(action: Action) -> anyhow::Result<()> {
997
+
log::debug!("Performing system switch");
let out = PathBuf::from(required_env("OUT")?);
let toplevel = PathBuf::from(required_env("TOPLEVEL")?);
let distro_id = required_env("DISTRO_ID")?;
···
let install_bootloader = required_env("INSTALL_BOOTLOADER")?;
let locale_archive = required_env("LOCALE_ARCHIVE")?;
let new_systemd = PathBuf::from(required_env("SYSTEMD")?);
1006
+
let log_level = if std::env::var("STC_DEBUG").is_ok() {
1007
+
LevelFilter::Debug
let action = ACTION.get_or_init(|| action);
1013
+
log::debug!("Using action {:?}", action);
// The action that is to be performed (like switch, boot, test, dry-activate) Also exposed via
// environment variable from now on
···
std::fs::set_permissions("/run/nixos", perms)
.context("Failed to set permissions on /run/nixos directory")?;
1045
+
log::debug!("Creating lock file /run/nixos/switch-to-configuration.lock");
let Ok(lock) = std::fs::OpenOptions::new()
···
1055
+
log::debug!("Acquiring lock on file /run/nixos/switch-to-configuration.lock");
let Ok(_lock) = Flock::lock(lock, FlockArg::LockExclusiveNonblock) else {
eprintln!("Could not acquire lock");
1046
-
if syslog::init(Facility::LOG_USER, LevelFilter::Debug, Some("nixos")).is_err() {
1061
+
if syslog::init(Facility::LOG_USER, log_level, Some("nixos")).is_err() {
bail!("Failed to initialize logger");
···
do_pre_switch_check(&pre_switch_check, &toplevel, action)?;
1071
+
log::debug!("Done performing pre-switch checks");
if *action == Action::Check {
···
// Install or update the bootloader.
if matches!(action, Action::Switch | Action::Boot) {
do_install_bootloader(&install_bootloader, &toplevel)?;
1081
+
log::debug!("Done performing bootloader installation");
// Just in case the new configuration hangs the system, do a sync now.
···
eprintln!("restarting systemd...");
_ = systemd.reexecute(); // we don't get a dbus reply here
1662
+
log::debug!("waiting for systemd restart to finish");
while !*systemd_reload_status.borrow() {
.process(Duration::from_millis(500))
···
// Make systemd reload its units.
_ = systemd.reload(); // we don't get a dbus reply here
1677
+
log::debug!("waiting for systemd reload to finish");
while !*systemd_reload_status.borrow() {
.process(Duration::from_millis(500))
···
.context("Failed to get full path to /proc/self/exe")?;
1714
+
log::debug!("Performing user switch for {name}");
std::process::Command::new(&myself)