Skip to content

Commit

Permalink
cli: Detect non-ostree and error out earlier
Browse files Browse the repository at this point in the history
Before we even check for root, verify that we are on an ostree-booted
host.

Signed-off-by: Colin Walters <walters@verbum.org>
  • Loading branch information
cgwalters committed May 22, 2024
1 parent 6a19638 commit 91db5ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ pub(crate) async fn prepare_for_write() -> Result<()> {
if ostree_ext::container_utils::running_in_container() {
anyhow::bail!("Detected container; this command requires a booted host system.");
}
if !std::path::Path::new("/run/ostree-booted").exists() {
anyhow::bail!("This command requires an ostree-booted host system");
}
crate::cli::require_root()?;
ensure_self_unshared_mount_namespace().await?;
if crate::lsm::selinux_enabled()? && !crate::lsm::selinux_ensure_install()? {
Expand Down

0 comments on commit 91db5ea

Please sign in to comment.