(system_info: &SystemInfo, packages: &[&str])
| 96 | } |
| 97 | |
| 98 | pub fn install(system_info: &SystemInfo, packages: &[&str]) -> Result<()> { |
| 99 | if !is_system_compatible(system_info) { |
| 100 | bail!( |
| 101 | "Package installation is not supported on this system, please install necessary packages manually" |
| 102 | ); |
| 103 | } |
| 104 | |
| 105 | info!("Installing packages: {}", packages.join(", ")); |
| 106 | |
| 107 | run_with_sudo("apt-get", ["update"])?; |
| 108 | let mut install_argv = vec!["install", "-y", "--allow-downgrades"]; |
| 109 | install_argv.extend_from_slice(packages); |
| 110 | run_with_sudo("apt-get", &install_argv)?; |
| 111 | |
| 112 | debug!("Packages installed successfully"); |
| 113 | Ok(()) |
| 114 | } |
| 115 | |
| 116 | /// Restore cached tools from the cache directory to the root filesystem |
| 117 | fn restore_from_cache(system_info: &SystemInfo, cache_dir: &Path) -> Result<()> { |
no test coverage detected