@@ -247,10 +247,17 @@ pub(crate) struct InstallConfigOpts {
247247
248248#[ derive( Debug , Default , Clone , clap:: Parser , Serialize , Deserialize , PartialEq , Eq ) ]
249249pub ( crate ) struct InstallComposefsOpts {
250+ /// If true, composefs backend is used, else ostree backend is used
251+ #[ clap( long, default_value_t) ]
252+ #[ serde( default ) ]
253+ pub ( crate ) composefs_backend : bool ,
254+
255+ /// Make fs-verity validation optional in case the filesystem doesn't support it
250256 #[ clap( long, default_value_t) ]
251257 #[ serde( default ) ]
252258 pub ( crate ) insecure : bool ,
253259
260+ /// The bootloader to use.
254261 #[ clap( long) ]
255262 #[ serde( default ) ]
256263 pub ( crate ) bootloader : Option < Bootloader > ,
@@ -286,11 +293,6 @@ pub(crate) struct InstallToDiskOpts {
286293 #[ serde( default ) ]
287294 pub ( crate ) via_loopback : bool ,
288295
289- #[ clap( long) ]
290- #[ serde( default ) ]
291- #[ cfg( feature = "composefs-backend" ) ]
292- pub ( crate ) composefs_native : bool ,
293-
294296 #[ clap( flatten) ]
295297 #[ serde( flatten) ]
296298 #[ cfg( feature = "composefs-backend" ) ]
@@ -371,10 +373,6 @@ pub(crate) struct InstallToFilesystemOpts {
371373 #[ clap( flatten) ]
372374 pub ( crate ) config_opts : InstallConfigOpts ,
373375
374- #[ clap( long) ]
375- #[ cfg( feature = "composefs-backend" ) ]
376- pub ( crate ) composefs_native : bool ,
377-
378376 #[ cfg( feature = "composefs-backend" ) ]
379377 #[ clap( flatten) ]
380378 pub ( crate ) composefs_opts : InstallComposefsOpts ,
@@ -450,7 +448,7 @@ pub(crate) struct State {
450448
451449 // If Some, then --composefs_native is passed
452450 #[ cfg( feature = "composefs-backend" ) ]
453- pub ( crate ) composefs_options : Option < InstallComposefsOpts > ,
451+ pub ( crate ) composefs_options : InstallComposefsOpts ,
454452
455453 /// Detected bootloader type for the target system
456454 pub ( crate ) detected_bootloader : crate :: spec:: Bootloader ,
@@ -583,10 +581,10 @@ impl FromStr for MountSpec {
583581#[ cfg( all( feature = "install-to-disk" , feature = "composefs-backend" ) ) ]
584582impl InstallToDiskOpts {
585583 pub ( crate ) fn validate ( & self ) -> Result < ( ) > {
586- if !self . composefs_native {
587- // Reject using --insecure without --composefs
584+ if !self . composefs_opts . composefs_backend {
585+ // Reject using --insecure without --composefs-backend
588586 if self . composefs_opts . insecure != false {
589- anyhow:: bail!( "--insecure must not be provided without --composefs" ) ;
587+ anyhow:: bail!( "--insecure must not be provided without --composefs-backend " ) ;
590588 }
591589 }
592590
@@ -1248,7 +1246,7 @@ async fn prepare_install(
12481246 config_opts : InstallConfigOpts ,
12491247 source_opts : InstallSourceOpts ,
12501248 target_opts : InstallTargetOpts ,
1251- composefs_options : Option < InstallComposefsOpts > ,
1249+ # [ cfg ( feature = "composefs-backend" ) ] composefs_options : InstallComposefsOpts ,
12521250) -> Result < Arc < State > > {
12531251 tracing:: trace!( "Preparing install" ) ;
12541252 let rootfs = cap_std:: fs:: Dir :: open_ambient_dir ( "/" , cap_std:: ambient_authority ( ) )
@@ -1321,8 +1319,6 @@ async fn prepare_install(
13211319 false
13221320 } ;
13231321 tracing:: debug!( "Composefs required: {composefs_required}" ) ;
1324- let composefs_options =
1325- composefs_options. or_else ( || composefs_required. then_some ( InstallComposefsOpts :: default ( ) ) ) ;
13261322
13271323 // We need to access devices that are set up by the host udev
13281324 bootc_mount:: ensure_mirrored_host_mount ( "/dev" ) ?;
@@ -1394,10 +1390,7 @@ async fn prepare_install(
13941390 // Priority: user-specified > bootupd availability > systemd-boot fallback
13951391 #[ cfg( feature = "composefs-backend" ) ]
13961392 let detected_bootloader = {
1397- if let Some ( bootloader) = composefs_options
1398- . as_ref ( )
1399- . and_then ( |opts| opts. bootloader . clone ( ) )
1400- {
1393+ if let Some ( bootloader) = composefs_options. bootloader . clone ( ) {
14011394 bootloader
14021395 } else {
14031396 if crate :: bootloader:: supports_bootupd ( None ) ? {
@@ -1426,9 +1419,9 @@ async fn prepare_install(
14261419 tempdir,
14271420 host_is_container,
14281421 composefs_required,
1422+ detected_bootloader,
14291423 #[ cfg( feature = "composefs-backend" ) ]
14301424 composefs_options,
1431- detected_bootloader,
14321425 } ) ;
14331426
14341427 Ok ( state)
@@ -1600,7 +1593,7 @@ async fn install_to_filesystem_impl(
16001593 }
16011594
16021595 #[ cfg( feature = "composefs-backend" ) ]
1603- if state. composefs_options . is_some ( ) {
1596+ if state. composefs_options . composefs_backend {
16041597 // Load a fd for the mounted target physical root
16051598
16061599 let ( id, verity) = initialize_composefs_repository ( state, rootfs) . await ?;
@@ -1677,21 +1670,12 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
16771670 anyhow:: bail!( "Not a block device: {}" , block_opts. device) ;
16781671 }
16791672
1680- #[ cfg( feature = "composefs-backend" ) ]
1681- let composefs_arg = if opts. composefs_native {
1682- Some ( opts. composefs_opts )
1683- } else {
1684- None
1685- } ;
1686-
1687- #[ cfg( not( feature = "composefs-backend" ) ) ]
1688- let composefs_arg = None ;
1689-
16901673 let state = prepare_install (
16911674 opts. config_opts ,
16921675 opts. source_opts ,
16931676 opts. target_opts ,
1694- composefs_arg,
1677+ #[ cfg( feature = "composefs-backend" ) ]
1678+ opts. composefs_opts ,
16951679 )
16961680 . await ?;
16971681
@@ -1929,9 +1913,7 @@ pub(crate) async fn install_to_filesystem(
19291913 opts. source_opts ,
19301914 opts. target_opts ,
19311915 #[ cfg( feature = "composefs-backend" ) ]
1932- opts. composefs_native . then_some ( opts. composefs_opts ) ,
1933- #[ cfg( not( feature = "composefs-backend" ) ) ]
1934- None ,
1916+ opts. composefs_opts ,
19351917 )
19361918 . await ?;
19371919
@@ -2203,12 +2185,11 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
22032185 target_opts : opts. target_opts ,
22042186 config_opts : opts. config_opts ,
22052187 #[ cfg( feature = "composefs-backend" ) ]
2206- composefs_native : false ,
2207- #[ cfg( feature = "composefs-backend" ) ]
22082188 composefs_opts : InstallComposefsOpts {
2189+ composefs_backend : true ,
22092190 insecure : false ,
2210- bootloader : Bootloader :: Grub ,
22112191 uki_addon : None ,
2192+ bootloader : None ,
22122193 } ,
22132194 } ;
22142195
0 commit comments