diff options
| author | qvkap <qvkapp@gmail.com> | 2026-10-01 07:25:04 +0300 |
|---|---|---|
| committer | qvkap <qvkapp@gmail.com> | 2026-10-01 07:26:37 +0300 |
| commit | 49d816d9314379e80ec47c62385e404874eb2904 (patch) | |
| tree | 56856d7c981c39ba0c99e09871345f75c95c6c97 /src/rootfs.rs | |
| parent | d4db32e8b7edb41c40e0bcc947b9076520ec5d20 (diff) | |
| download | ror-49d816d9314379e80ec47c62385e404874eb2904.tar.gz ror-49d816d9314379e80ec47c62385e404874eb2904.zip | |
fix(rootfs,resolver): run ldconfig in sysroot, handle optional install steps, improve multi-init service deployment
Diffstat (limited to 'src/rootfs.rs')
| -rw-r--r-- | src/rootfs.rs | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/rootfs.rs b/src/rootfs.rs index c53b879..46025d0 100644 --- a/src/rootfs.rs +++ b/src/rootfs.rs @@ -523,6 +523,15 @@ fn mount_virtual_fs(root_dir: &Path) -> Result<(), String> { MsFlags::MS_BIND | MsFlags::MS_REC, None::<&Path>, ) + .map_err(|e| format!("Failed to bind mount {}: {}", rel, e))?; + + let _ = mount( + None::<&Path>, + &target, + None::<&str>, + MsFlags::MS_PRIVATE | MsFlags::MS_REC, + None::<&Path>, + ); } else { mount( Some(Path::new(src)), @@ -531,8 +540,8 @@ fn mount_virtual_fs(root_dir: &Path) -> Result<(), String> { MsFlags::empty(), None::<&Path>, ) + .map_err(|e| format!("Failed to mount {}: {}", rel, e))?; } - .map_err(|e| format!("Failed to mount {}: {}", rel, e))?; } Ok(()) } @@ -679,32 +688,25 @@ fn run_install_steps_in_chroot( } fn run_ldconfig_in_root(root_dir: &Path) -> Result<(), String> { + let status = std::process::Command::new("ldconfig") + .arg("-r") + .arg(root_dir) + .arg("-C") + .arg("/etc/ld.so.cache") + .status(); + if let Ok(s) = status { + if s.success() { + debug!("Host ldconfig -r generated /etc/ld.so.cache successfully"); + return Ok(()); + } + } + let ldconfig_path = if root_dir.join("sbin/ldconfig").exists() { "/sbin/ldconfig" } else if root_dir.join("usr/sbin/ldconfig").exists() { "/usr/sbin/ldconfig" } else { - debug!("Target rootfs lacks ldconfig, attempting host ldconfig -r..."); - let status = std::process::Command::new("ldconfig") - .arg("-r") - .arg(root_dir) - .arg("-C") - .arg("/etc/ld.so.cache") - .status(); - match status { - Ok(s) if s.success() => { - debug!("Host ldconfig -r generated /etc/ld.so.cache successfully"); - return Ok(()); - } - Ok(s) => { - debug!("Host ldconfig -r exited with: {}", s); - return Ok(()); - } - Err(e) => { - debug!("Failed to run host ldconfig: {}", e); - return Ok(()); - } - } + return Err("No ldconfig available".to_string()); }; match unsafe { fork() } { @@ -756,6 +758,10 @@ fn run_all_install_steps( .map(|s| s.to_string()) .collect(); + if steps_pkgs.is_empty() { + return Ok(()); + } + let mut pb = ProgressBar::new(steps_pkgs.len().max(1), "Running install steps..."); let (shell, subcmd) = find_working_shell(target_dir) |