Skip to content

Commit 2c1d0b5

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 b5f47ff commit 2c1d0b5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/src/install.rs

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

47-
/// The default "stateroot" or "osname"; see https://github.com/ostreedev/ostree/issues/2794
48-
const STATEROOT_DEFAULT: &str = "default";
4947
/// The toplevel boot directory
5048
const BOOT: &str = "boot";
5149
/// Directory for transient runtime state
@@ -159,6 +157,10 @@ pub(crate) struct InstallConfigOpts {
159157
#[clap(long)]
160158
#[serde(default)]
161159
pub(crate) generic_image: bool,
160+
161+
/// The stateroot name to use. Defaults to `default`.
162+
#[clap(long, default_value = ostree_ext::container::deploy::STATEROOT_DEFAULT, hide = true)]
163+
pub(crate) stateroot: String,
162164
}
163165

164166
#[derive(Debug, Clone, clap::Parser, Serialize, Deserialize, PartialEq, Eq)]
@@ -546,8 +548,9 @@ async fn initialize_ostree_root_from_self(
546548
// Another implementation: https://github.com/coreos/coreos-assembler/blob/3cd3307904593b3a131b81567b13a4d0b6fe7c90/src/create_disk.sh#L295
547549
crate::lsm::ensure_dir_labeled(rootfs_dir, "", Some("/".into()), 0o755.into(), sepolicy)?;
548550

549-
// TODO: make configurable?
550-
let stateroot = STATEROOT_DEFAULT;
551+
let stateroot = &state
552+
.config_opts
553+
.stateroot;
551554
Task::new_and_run(
552555
"Initializing ostree layout",
553556
"ostree",

0 commit comments

Comments
 (0)