forked from ostreedev/ostree-rs-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: ostreedev#69 This is initial basic support for splitting files (objects) from a commit into separate container image layers, and reassembling those layers into a commit on the client. We retain our present logic around e.g. GPG signature verification. There's a new `chunking.rs` file which has logic to automatically factor out things like the kernel/initramfs and large files. In order to fetch these images client side, we now heavily intermix/cross the previous code for fetching non-ostree layers.
- Loading branch information
Showing
14 changed files
with
1,368 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! Helper functions for bootable OSTrees. | ||
|
||
use anyhow::Result; | ||
use ostree::gio; | ||
use ostree::prelude::*; | ||
|
||
const MODULES: &str = "/usr/lib/modules"; | ||
|
||
/// Find the kernel modules directory in a bootable OSTree commit. | ||
pub fn find_kernel_dir( | ||
root: &gio::File, | ||
cancellable: Option<&gio::Cancellable>, | ||
) -> Result<Option<gio::File>> { | ||
let moddir = root.resolve_relative_path(MODULES); | ||
let e = moddir.enumerate_children( | ||
"standard::name", | ||
gio::FileQueryInfoFlags::NOFOLLOW_SYMLINKS, | ||
cancellable, | ||
)?; | ||
let mut r = None; | ||
for child in e.clone() { | ||
let child = &child?; | ||
let childpath = e.child(child); | ||
if child.file_type() == gio::FileType::Directory && r.replace(childpath).is_some() { | ||
anyhow::bail!("Found multiple subdirectories in {}", MODULES); | ||
} | ||
} | ||
Ok(r) | ||
} |
Oops, something went wrong.