@@ -249,10 +249,17 @@ pub(crate) struct InstallConfigOpts {
249249
250250#[ derive( Debug , Clone , clap:: Parser , Serialize , Deserialize , PartialEq , Eq ) ]
251251pub ( crate ) struct InstallComposefsOpts {
252+ /// If true, composefs backend is used, else ostree backend is used
253+ #[ clap( long, default_value_t) ]
254+ #[ serde( default ) ]
255+ pub ( crate ) composefs_backend : bool ,
256+
257+ /// Make fs-verity validation optional in case the filesystem doesn't support it
252258 #[ clap( long, default_value_t) ]
253259 #[ serde( default ) ]
254260 pub ( crate ) insecure : bool ,
255261
262+ /// The bootloader to use.
256263 #[ clap( long, default_value_t) ]
257264 #[ serde( default ) ]
258265 pub ( crate ) bootloader : Bootloader ,
@@ -288,11 +295,6 @@ pub(crate) struct InstallToDiskOpts {
288295 #[ serde( default ) ]
289296 pub ( crate ) via_loopback : bool ,
290297
291- #[ clap( long) ]
292- #[ serde( default ) ]
293- #[ cfg( feature = "composefs-backend" ) ]
294- pub ( crate ) composefs_native : bool ,
295-
296298 #[ clap( flatten) ]
297299 #[ serde( flatten) ]
298300 #[ cfg( feature = "composefs-backend" ) ]
@@ -373,10 +375,6 @@ pub(crate) struct InstallToFilesystemOpts {
373375 #[ clap( flatten) ]
374376 pub ( crate ) config_opts : InstallConfigOpts ,
375377
376- #[ clap( long) ]
377- #[ cfg( feature = "composefs-backend" ) ]
378- pub ( crate ) composefs_native : bool ,
379-
380378 #[ cfg( feature = "composefs-backend" ) ]
381379 #[ clap( flatten) ]
382380 pub ( crate ) composefs_opts : InstallComposefsOpts ,
@@ -446,9 +444,9 @@ pub(crate) struct State {
446444 pub ( crate ) container_root : Dir ,
447445 pub ( crate ) tempdir : TempDir ,
448446
449- // If Some, then --composefs_native is passed
447+ // If Some, then --composefs-backend is passed
450448 #[ cfg( feature = "composefs-backend" ) ]
451- pub ( crate ) composefs_options : Option < InstallComposefsOpts > ,
449+ pub ( crate ) composefs_options : InstallComposefsOpts ,
452450}
453451
454452impl State {
@@ -578,10 +576,10 @@ impl FromStr for MountSpec {
578576#[ cfg( all( feature = "install-to-disk" , feature = "composefs-backend" ) ) ]
579577impl InstallToDiskOpts {
580578 pub ( crate ) fn validate ( & self ) -> Result < ( ) > {
581- if !self . composefs_native {
582- // Reject using --insecure without --composefs
579+ if !self . composefs_opts . composefs_backend {
580+ // Reject using --insecure without --composefs-backend
583581 if self . composefs_opts . insecure != false {
584- anyhow:: bail!( "--insecure must not be provided without --composefs" ) ;
582+ anyhow:: bail!( "--insecure must not be provided without --composefs-backend " ) ;
585583 }
586584 }
587585
@@ -1234,7 +1232,7 @@ async fn prepare_install(
12341232 config_opts : InstallConfigOpts ,
12351233 source_opts : InstallSourceOpts ,
12361234 target_opts : InstallTargetOpts ,
1237- _composefs_opts : Option < InstallComposefsOpts > ,
1235+ # [ cfg ( feature = "composefs-backend" ) ] composefs_options : InstallComposefsOpts ,
12381236) -> Result < Arc < State > > {
12391237 tracing:: trace!( "Preparing install" ) ;
12401238 let rootfs = cap_std:: fs:: Dir :: open_ambient_dir ( "/" , cap_std:: ambient_authority ( ) )
@@ -1380,7 +1378,7 @@ async fn prepare_install(
13801378 tempdir,
13811379 host_is_container,
13821380 #[ cfg( feature = "composefs-backend" ) ]
1383- composefs_options : _composefs_opts ,
1381+ composefs_options,
13841382 } ) ;
13851383
13861384 Ok ( state)
@@ -1545,7 +1543,7 @@ async fn install_to_filesystem_impl(
15451543 }
15461544
15471545 #[ cfg( feature = "composefs-backend" ) ]
1548- if state. composefs_options . is_some ( ) {
1546+ if state. composefs_options . composefs_backend {
15491547 // Load a fd for the mounted target physical root
15501548
15511549 let ( id, verity) = initialize_composefs_repository ( state, rootfs) . await ?;
@@ -1622,21 +1620,12 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
16221620 anyhow:: bail!( "Not a block device: {}" , block_opts. device) ;
16231621 }
16241622
1625- #[ cfg( feature = "composefs-backend" ) ]
1626- let composefs_arg = if opts. composefs_native {
1627- Some ( opts. composefs_opts )
1628- } else {
1629- None
1630- } ;
1631-
1632- #[ cfg( not( feature = "composefs-backend" ) ) ]
1633- let composefs_arg = None ;
1634-
16351623 let state = prepare_install (
16361624 opts. config_opts ,
16371625 opts. source_opts ,
16381626 opts. target_opts ,
1639- composefs_arg,
1627+ #[ cfg( feature = "composefs-backend" ) ]
1628+ opts. composefs_opts ,
16401629 )
16411630 . await ?;
16421631
@@ -1874,9 +1863,7 @@ pub(crate) async fn install_to_filesystem(
18741863 opts. source_opts ,
18751864 opts. target_opts ,
18761865 #[ cfg( feature = "composefs-backend" ) ]
1877- opts. composefs_native . then_some ( opts. composefs_opts ) ,
1878- #[ cfg( not( feature = "composefs-backend" ) ) ]
1879- None ,
1866+ opts. composefs_opts ,
18801867 )
18811868 . await ?;
18821869
@@ -2148,9 +2135,8 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
21482135 target_opts : opts. target_opts ,
21492136 config_opts : opts. config_opts ,
21502137 #[ cfg( feature = "composefs-backend" ) ]
2151- composefs_native : false ,
2152- #[ cfg( feature = "composefs-backend" ) ]
21532138 composefs_opts : InstallComposefsOpts {
2139+ composefs_backend : true ,
21542140 insecure : false ,
21552141 bootloader : Bootloader :: Grub ,
21562142 uki_addon : None ,
0 commit comments