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::*;
21mod uki;
22pub use uki::*;
23
24pub const NAME: &str = "bootc";
26
27pub fn podman_bin() -> &'static str {
32 static BIN: std::sync::OnceLock<String> = std::sync::OnceLock::new();
33 BIN.get_or_init(|| {
34 std::env::var("BOOTC_EXP_EXTERNAL_CONTAINER_TOOL").unwrap_or_else(|_| "podman".to_string())
35 })
36}
37
38pub fn skopeo_bin() -> &'static str {
43 static BIN: std::sync::OnceLock<String> = std::sync::OnceLock::new();
44 BIN.get_or_init(|| {
45 std::env::var("BOOTC_EXP_EXTERNAL_CONTAINER_TOOL").unwrap_or_else(|_| "skopeo".to_string())
46 })
47}
48
49pub fn run_main<F>(f: F)
52where
53 F: FnOnce() -> anyhow::Result<()>,
54{
55 use std::io::Write as _;
56
57 use owo_colors::OwoColorize;
58
59 if let Err(e) = f() {
60 let mut stderr = anstream::stderr();
61 let _ = writeln!(stderr, "{}{:#}", "error: ".red(), e);
63 std::process::exit(1);
64 }
65}