Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Nov 11, 2024
1 parent 2079517 commit 21bf315
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
40 changes: 30 additions & 10 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,9 @@ pub(crate) enum InternalsOpts {
FixupEtcFstab,
/// Should only be used by `make update-generated`
PrintJsonSchema,
/// Perform consistency checking.
Fsck,
/// Operate on the global storage
#[clap(subcommand)]
Storage(StorageOpts),
/// Perform cleanup actions
Cleanup,
/// Proxy frontend for the `ostree-ext` CLI.
Expand All @@ -319,6 +320,18 @@ pub(crate) enum InternalsOpts {
},
}

#[derive(Debug, clap::Subcommand, PartialEq, Eq)]
pub(crate) enum StorageOpts {
/// Perform consistency checking
Fsck,
/// Output state of verity or dynamically enable it
Verity {
/// Change fsverity state to enabled.
#[clap(long)]
enable: bool,
},
}

#[derive(Debug, clap::Subcommand, PartialEq, Eq)]
pub(crate) enum StateOpts {
/// Remove all ostree deployments from this system
Expand Down Expand Up @@ -964,16 +977,23 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
)
.await
}
InternalsOpts::Fsck => {
InternalsOpts::Storage(opts) => {
let storage = get_storage().await?;
let r = crate::fsck::fsck(&storage).await?;
match r.errors.as_slice() {
[] => {}
errs => {
for err in errs {
eprintln!("error: {err}");
match opts {
StorageOpts::Fsck => {
let r = crate::fsck::fsck(&storage).await?;
match r.errors.as_slice() {
[] => {}
errs => {
for err in errs {
eprintln!("error: {err}");
}
anyhow::bail!("fsck found errors");
}
}
anyhow::bail!("fsck found errors");
}
StorageOpts::Verity { enable } => {

}
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion lib/src/install/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ fsverity = "enabled"
assert_eq!(install.fsverity.as_ref().unwrap(), &Tristate::Enabled);
let o: InstallConfigurationToplevel = toml::from_str(
r##"[install]
fsverity = "optional"
fsverity = "maybe"
"##,
)
.unwrap();
Expand Down
1 change: 1 addition & 0 deletions lib/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::spec::ImageStatus;

mod ostree_container;

/// The configuration option for fsverity
pub(crate) const REPO_VERITY_CONFIG: &str = "ex-integrity.fsverity";

pub(crate) struct Storage {
Expand Down

0 comments on commit 21bf315

Please sign in to comment.