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 sysroot;
51pub mod tar;
52pub mod tokio_util;
53
54pub mod selinux;
55
56pub mod chunking;
57pub mod commit;
58pub mod objectsource;
59pub(crate) mod objgv;
60#[cfg(feature = "internal-testing-api")]
61pub mod ostree_manual;
62#[cfg(not(feature = "internal-testing-api"))]
63pub(crate) mod ostree_manual;
64
65pub(crate) mod statistics;
66
67mod utils;
68
69#[cfg(feature = "docgen")]
70mod docgen;
71pub mod fsverity;
72
73/// Prelude, intended for glob import.
74pub mod prelude {
75    #[doc(hidden)]
76    pub use ostree::prelude::*;
77}
78
79#[cfg(feature = "internal-testing-api")]
80pub mod fixture;
81#[cfg(feature = "internal-testing-api")]
82pub mod integrationtest;
83
84/// Check if the system has the soft reboot target, which signals
85/// systemd support for soft reboots.
86pub fn systemd_has_soft_reboot() -> bool {
87    const UNIT: &str = "/usr/lib/systemd/system/soft-reboot.target";
88    use std::sync::OnceLock;
89    static EXISTS: OnceLock<bool> = OnceLock::new();
90    *EXISTS.get_or_init(|| std::path::Path::new(UNIT).exists())
91}