Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: Make stateroot configurable #622

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ use crate::mount::Filesystem;
use crate::task::Task;
use crate::utils::sigpolicy_from_opts;

/// The default "stateroot" or "osname"; see https://github.com/ostreedev/ostree/issues/2794
const STATEROOT_DEFAULT: &str = "default";
/// The toplevel boot directory
const BOOT: &str = "boot";
/// Directory for transient runtime state
Expand Down Expand Up @@ -158,6 +156,10 @@ pub(crate) struct InstallConfigOpts {
#[clap(long)]
#[serde(default)]
pub(crate) generic_image: bool,

/// The stateroot name to use. Defaults to `default`.
#[clap(long, hide = true)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should at least debate: any reason not to stabilize (i.e. not hide = true) this? This really I guess is just the question of whether we want to tie bootc to the ostree concept of "stateroot" as is basically forever.

I think it's unlikely to be valuable for us to try to do anything really different here, so I'd say stabilize.

pub(crate) stateroot: Option<String>,
}

#[derive(Debug, Clone, clap::Parser, Serialize, Deserialize, PartialEq, Eq)]
Expand Down Expand Up @@ -558,8 +560,12 @@ async fn initialize_ostree_root_from_self(
// Another implementation: https://github.com/coreos/coreos-assembler/blob/3cd3307904593b3a131b81567b13a4d0b6fe7c90/src/create_disk.sh#L295
crate::lsm::ensure_dir_labeled(rootfs_dir, "", Some("/".into()), 0o755.into(), sepolicy)?;

// TODO: make configurable?
let stateroot = STATEROOT_DEFAULT;
let stateroot = state
.config_opts
.stateroot
.as_deref()
.unwrap_or(ostree_ext::container::deploy::STATEROOT_DEFAULT);

Task::new_and_run(
"Initializing ostree layout",
"ostree",
Expand Down
Loading