@@ -51,8 +51,6 @@ use crate::store::Storage;
51
51
use crate :: task:: Task ;
52
52
use crate :: utils:: sigpolicy_from_opts;
53
53
54
- /// The default "stateroot" or "osname"; see https://github.com/ostreedev/ostree/issues/2794
55
- const STATEROOT_DEFAULT : & str = "default" ;
56
54
/// The toplevel boot directory
57
55
const BOOT : & str = "boot" ;
58
56
/// Directory for transient runtime state
@@ -171,6 +169,10 @@ pub(crate) struct InstallConfigOpts {
171
169
#[ clap( long, hide = true ) ]
172
170
#[ serde( default ) ]
173
171
pub ( crate ) skip_bound_images : bool ,
172
+
173
+ /// The stateroot name to use. Defaults to `default`.
174
+ #[ clap( long) ]
175
+ pub ( crate ) stateroot : Option < String > ,
174
176
}
175
177
176
178
#[ derive( Debug , Clone , clap:: Parser , Serialize , Deserialize , PartialEq , Eq ) ]
@@ -567,8 +569,12 @@ async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result
567
569
// Another implementation: https://github.com/coreos/coreos-assembler/blob/3cd3307904593b3a131b81567b13a4d0b6fe7c90/src/create_disk.sh#L295
568
570
crate :: lsm:: ensure_dir_labeled ( rootfs_dir, "" , Some ( "/" . into ( ) ) , 0o755 . into ( ) , sepolicy) ?;
569
571
570
- // TODO: make configurable?
571
- let stateroot = STATEROOT_DEFAULT ;
572
+ let stateroot = state
573
+ . config_opts
574
+ . stateroot
575
+ . as_deref ( )
576
+ . unwrap_or ( ostree_ext:: container:: deploy:: STATEROOT_DEFAULT ) ;
577
+
572
578
Task :: new_and_run (
573
579
"Initializing ostree layout" ,
574
580
"ostree" ,
@@ -638,7 +644,11 @@ async fn install_container(
638
644
) -> Result < ( ostree:: Deployment , InstallAleph ) > {
639
645
let sepolicy = state. load_policy ( ) ?;
640
646
let sepolicy = sepolicy. as_ref ( ) ;
641
- let stateroot = STATEROOT_DEFAULT ;
647
+ let stateroot = state
648
+ . config_opts
649
+ . stateroot
650
+ . as_deref ( )
651
+ . unwrap_or ( ostree_ext:: container:: deploy:: STATEROOT_DEFAULT ) ;
642
652
643
653
let container_rootfs = & Dir :: open_ambient_dir ( "/" , cap_std:: ambient_authority ( ) ) ?;
644
654
@@ -1099,7 +1109,9 @@ pub(crate) fn setup_sys_mount(fstype: &str, fspath: &str) -> Result<()> {
1099
1109
Task :: new ( format ! ( "Mounting {fstype} {fspath}" ) , "mount" )
1100
1110
. args ( [ "-t" , fstype, fstype, fspath] )
1101
1111
. quiet ( )
1102
- . run ( )
1112
+ . run ( ) ?;
1113
+
1114
+ Ok ( ( ) )
1103
1115
}
1104
1116
1105
1117
/// Verify that we can load the manifest of the target image
0 commit comments