ostree_ext/
lib.rs

1//! # Extension APIs for ostree
2//!
3//! This crate builds on top of the core ostree C library
4//! and the Rust bindings to it, adding new functionality
5//! written in Rust.  
6
7// See https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
8#![deny(missing_docs)]
9#![deny(missing_debug_implementations)]
10#![forbid(unused_must_use)]
11#![deny(unsafe_code)]
12#![cfg_attr(feature = "dox", feature(doc_cfg))]
13#![deny(clippy::dbg_macro)]
14#![deny(clippy::todo)]
15
16// Re-export our dependencies.  See https://gtk-rs.org/blog/2021/06/22/new-release.html
17// "Dependencies are re-exported".  Users will need e.g. `gio::File`, so this avoids
18// them needing to update matching versions.
19pub use composefs;
20pub use composefs_boot;
21pub use composefs_oci;
22pub use containers_image_proxy;
23pub use containers_image_proxy::oci_spec;
24pub use ostree;
25pub use ostree::gio;
26pub use ostree::gio::glib;
27
28/// Our generic catchall fatal error, expected to be converted
29/// to a string to output to a terminal or logs.
30type Result<T> = anyhow::Result<T>;
31
32// Import global functions.
33pub mod globals;
34
35mod isolation;
36
37pub mod bootabletree;
38pub mod cli;
39pub mod container;
40pub mod container_utils;
41pub mod diff;
42pub(crate) mod generic_decompress;
43pub mod ima;
44pub mod keyfileext;
45pub(crate) mod logging;
46pub mod ostree_prepareroot;
47pub mod refescape;
48#[doc(hidden)]
49pub mod repair;
50pub mod repo_options;
51pub mod sysroot;
52pub mod tar;
53pub mod tokio_util;
54
55pub mod selinux;
56
57pub mod chunking;
58pub mod commit;
59pub mod objectsource;
60pub(crate) mod objgv;
61#[cfg(feature = "internal-testing-api")]
62pub mod ostree_manual;
63#[cfg(not(feature = "internal-testing-api"))]
64pub(crate) mod ostree_manual;
65
66pub(crate) mod statistics;
67
68mod utils;
69
70#[cfg(feature = "docgen")]
71mod docgen;
72pub mod fsverity;
73
74/// Prelude, intended for glob import.
75pub mod prelude {
76    #[doc(hidden)]
77    pub use ostree::prelude::*;
78}
79
80#[cfg(feature = "internal-testing-api")]
81pub mod fixture;
82#[cfg(feature = "internal-testing-api")]
83pub mod integrationtest;
84
85/// Check if the system has the soft reboot target, which signals
86/// systemd support for soft reboots.
87pub fn systemd_has_soft_reboot() -> bool {
88    const UNIT: &str = "/usr/lib/systemd/system/soft-reboot.target";
89    use std::sync::OnceLock;
90    static EXISTS: OnceLock<bool> = OnceLock::new();
91    *EXISTS.get_or_init(|| std::path::Path::new(UNIT).exists())
92}