Skip to content

Commit 9f34577

Browse files
committed
install: Make stateroot configurable
This commit makes it so that the `bootc install` stateroot will be configurable (it defaults to `default`). For now this is a hidden CLI option until we decide whether we want to commit to this API. In the future we also want to make the stateroot of `bootc switch` be configurable (bootc-dev#617) so that users can install an image to a new stateroot while they already have an existing stateroot Also removed the constant `STATEROOT_DEFAULT`, we're now simply taking it from the `ostree_ext` crate
1 parent 1029162 commit 9f34577

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/src/install.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ use crate::mount::Filesystem;
4343
use crate::task::Task;
4444
use crate::utils::sigpolicy_from_opts;
4545

46-
/// The default "stateroot" or "osname"; see https://github.com/ostreedev/ostree/issues/2794
47-
const STATEROOT_DEFAULT: &str = "default";
4846
/// The toplevel boot directory
4947
const BOOT: &str = "boot";
5048
/// Directory for transient runtime state
@@ -158,6 +156,10 @@ pub(crate) struct InstallConfigOpts {
158156
#[clap(long)]
159157
#[serde(default)]
160158
pub(crate) generic_image: bool,
159+
160+
/// The stateroot name to use. Defaults to `default`.
161+
#[clap(long, hide = true)]
162+
pub(crate) stateroot: Option<String>,
161163
}
162164

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

561-
// TODO: make configurable?
562-
let stateroot = STATEROOT_DEFAULT;
563+
let stateroot = state
564+
.config_opts
565+
.stateroot
566+
.as_deref()
567+
.unwrap_or(ostree_ext::container::deploy::STATEROOT_DEFAULT);
568+
563569
Task::new_and_run(
564570
"Initializing ostree layout",
565571
"ostree",

0 commit comments

Comments
 (0)