@@ -249,10 +249,21 @@ pub(crate) struct InstallConfigOpts {
249
249
250
250
#[ derive( Debug , Clone , clap:: Parser , Serialize , Deserialize , PartialEq , Eq ) ]
251
251
pub ( 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
252
258
#[ clap( long, default_value_t) ]
253
259
#[ serde( default ) ]
254
260
pub ( crate ) insecure : bool ,
255
261
262
+ /// The bootloader to use.
263
+ /// Currently supported:
264
+ ///
265
+ /// - systemd-boot
266
+ /// - grub
256
267
#[ clap( long, default_value_t) ]
257
268
#[ serde( default ) ]
258
269
pub ( crate ) bootloader : Bootloader ,
@@ -288,11 +299,6 @@ pub(crate) struct InstallToDiskOpts {
288
299
#[ serde( default ) ]
289
300
pub ( crate ) via_loopback : bool ,
290
301
291
- #[ clap( long) ]
292
- #[ serde( default ) ]
293
- #[ cfg( feature = "composefs-backend" ) ]
294
- pub ( crate ) composefs_native : bool ,
295
-
296
302
#[ clap( flatten) ]
297
303
#[ serde( flatten) ]
298
304
#[ cfg( feature = "composefs-backend" ) ]
@@ -373,10 +379,6 @@ pub(crate) struct InstallToFilesystemOpts {
373
379
#[ clap( flatten) ]
374
380
pub ( crate ) config_opts : InstallConfigOpts ,
375
381
376
- #[ clap( long) ]
377
- #[ cfg( feature = "composefs-backend" ) ]
378
- pub ( crate ) composefs_native : bool ,
379
-
380
382
#[ cfg( feature = "composefs-backend" ) ]
381
383
#[ clap( flatten) ]
382
384
pub ( crate ) compoesfs_opts : InstallComposefsOpts ,
@@ -446,9 +448,9 @@ pub(crate) struct State {
446
448
pub ( crate ) container_root : Dir ,
447
449
pub ( crate ) tempdir : TempDir ,
448
450
449
- // If Some, then --composefs_native is passed
451
+ // If Some, then --composefs-backend is passed
450
452
#[ cfg( feature = "composefs-backend" ) ]
451
- pub ( crate ) composefs_options : Option < InstallComposefsOpts > ,
453
+ pub ( crate ) composefs_options : InstallComposefsOpts ,
452
454
}
453
455
454
456
impl State {
@@ -578,10 +580,10 @@ impl FromStr for MountSpec {
578
580
#[ cfg( all( feature = "install-to-disk" , feature = "composefs-backend" ) ) ]
579
581
impl InstallToDiskOpts {
580
582
pub ( crate ) fn validate ( & self ) -> Result < ( ) > {
581
- if !self . composefs_native {
582
- // Reject using --insecure without --composefs
583
+ if !self . composefs_opts . composefs_backend {
584
+ // Reject using --insecure without --composefs-backend
583
585
if self . composefs_opts . insecure != false {
584
- anyhow:: bail!( "--insecure must not be provided without --composefs" ) ;
586
+ anyhow:: bail!( "--insecure must not be provided without --composefs-backend " ) ;
585
587
}
586
588
}
587
589
@@ -1234,7 +1236,8 @@ async fn prepare_install(
1234
1236
config_opts : InstallConfigOpts ,
1235
1237
source_opts : InstallSourceOpts ,
1236
1238
target_opts : InstallTargetOpts ,
1237
- _composefs_opts : Option < InstallComposefsOpts > ,
1239
+ #[ cfg( feature = "composefs-backend" ) ]
1240
+ composefs_options : InstallComposefsOpts ,
1238
1241
) -> Result < Arc < State > > {
1239
1242
tracing:: trace!( "Preparing install" ) ;
1240
1243
let rootfs = cap_std:: fs:: Dir :: open_ambient_dir ( "/" , cap_std:: ambient_authority ( ) )
@@ -1380,7 +1383,7 @@ async fn prepare_install(
1380
1383
tempdir,
1381
1384
host_is_container,
1382
1385
#[ cfg( feature = "composefs-backend" ) ]
1383
- composefs_options : _composefs_opts ,
1386
+ composefs_options
1384
1387
} ) ;
1385
1388
1386
1389
Ok ( state)
@@ -1545,7 +1548,7 @@ async fn install_to_filesystem_impl(
1545
1548
}
1546
1549
1547
1550
#[ cfg( feature = "composefs-backend" ) ]
1548
- if state. composefs_options . is_some ( ) {
1551
+ if state. composefs_options . composefs_backend {
1549
1552
// Load a fd for the mounted target physical root
1550
1553
1551
1554
let ( id, verity) = initialize_composefs_repository ( state, rootfs) . await ?;
@@ -1622,21 +1625,12 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
1622
1625
anyhow:: bail!( "Not a block device: {}" , block_opts. device) ;
1623
1626
}
1624
1627
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
-
1635
1628
let state = prepare_install (
1636
1629
opts. config_opts ,
1637
1630
opts. source_opts ,
1638
1631
opts. target_opts ,
1639
- composefs_arg,
1632
+ #[ cfg( feature = "composefs-backend" ) ]
1633
+ opts. composefs_opts ,
1640
1634
)
1641
1635
. await ?;
1642
1636
@@ -1874,9 +1868,7 @@ pub(crate) async fn install_to_filesystem(
1874
1868
opts. source_opts ,
1875
1869
opts. target_opts ,
1876
1870
#[ cfg( feature = "composefs-backend" ) ]
1877
- opts. composefs_native . then_some ( opts. compoesfs_opts ) ,
1878
- #[ cfg( not( feature = "composefs-backend" ) ) ]
1879
- None ,
1871
+ opts. compoesfs_opts ,
1880
1872
)
1881
1873
. await ?;
1882
1874
@@ -2148,9 +2140,8 @@ pub(crate) async fn install_to_existing_root(opts: InstallToExistingRootOpts) ->
2148
2140
target_opts : opts. target_opts ,
2149
2141
config_opts : opts. config_opts ,
2150
2142
#[ cfg( feature = "composefs-backend" ) ]
2151
- composefs_native : false ,
2152
- #[ cfg( feature = "composefs-backend" ) ]
2153
2143
compoesfs_opts : InstallComposefsOpts {
2144
+ composefs_backend : true ,
2154
2145
insecure : false ,
2155
2146
bootloader : Bootloader :: Grub ,
2156
2147
uki_addon : None ,
0 commit comments