()
| 328 | |
| 329 | #[context("Querying bootctl version")] |
| 330 | pub(crate) fn bootctl_systemd_version() -> Result<u32> { |
| 331 | static VERSION: OnceLock<u32> = OnceLock::new(); |
| 332 | |
| 333 | if let Some(v) = VERSION.get() { |
| 334 | return Ok(*v); |
| 335 | }; |
| 336 | |
| 337 | let out = Command::new("bootctl").arg("--version").run_get_string()?; |
| 338 | let v = parse_systemd_version(&out).context("Failed to parse version to integer")?; |
| 339 | |
| 340 | let version = VERSION.get_or_init(|| v); |
| 341 | |
| 342 | Ok(*version) |
| 343 | } |
| 344 | |
| 345 | /// Parse the systemd major version from `bootctl --version` output, whose first |
| 346 | /// line looks like `systemd 259 (259.5-0ubuntu3)`. |
no test coverage detected