bootc_internal_utils/
lib.rs1mod chroot;
6pub use chroot::*;
7mod command;
8pub use command::*;
9mod iterators;
10pub use iterators::*;
11mod path;
12pub use path::*;
13pub mod reexec;
15mod result_ext;
16pub use result_ext::*;
17mod timestamp;
18pub use timestamp::*;
19mod tracing_util;
20pub use tracing_util::*;
21
22pub const NAME: &str = "bootc";
24
25pub fn podman_bin() -> &'static str {
30 static BIN: std::sync::OnceLock<String> = std::sync::OnceLock::new();
31 BIN.get_or_init(|| {
32 std::env::var("BOOTC_EXP_EXTERNAL_CONTAINER_TOOL").unwrap_or_else(|_| "podman".to_string())
33 })
34}
35
36pub fn skopeo_bin() -> &'static str {
41 static BIN: std::sync::OnceLock<String> = std::sync::OnceLock::new();
42 BIN.get_or_init(|| {
43 std::env::var("BOOTC_EXP_EXTERNAL_CONTAINER_TOOL").unwrap_or_else(|_| "skopeo".to_string())
44 })
45}
46
47pub fn run_main<F>(f: F)
50where
51 F: FnOnce() -> anyhow::Result<()>,
52{
53 use std::io::Write as _;
54
55 use owo_colors::OwoColorize;
56
57 if let Err(e) = f() {
58 let mut stderr = anstream::stderr();
59 let _ = writeln!(stderr, "{}{:#}", "error: ".red(), e);
61 std::process::exit(1);
62 }
63}