@@ -211,15 +211,35 @@ func genPartitionTable(c *ManifestConfig, customizations *blueprint.Customizatio
211
211
if err != nil {
212
212
return nil , fmt .Errorf ("error reading disk customizations: %w" , err )
213
213
}
214
+ var partitionTable * disk.PartitionTable
214
215
switch {
215
216
// XXX: move into images library
216
217
case fsCust != nil && diskCust != nil :
217
218
return nil , fmt .Errorf ("cannot combine disk and filesystem customizations" )
218
219
case diskCust != nil :
219
- return genPartitionTableDiskCust (c , diskCust , rng )
220
+ partitionTable , err = genPartitionTableDiskCust (c , diskCust , rng )
221
+ if err != nil {
222
+ return nil , err
223
+ }
220
224
default :
221
- return genPartitionTableFsCust (c , fsCust , rng )
225
+ partitionTable , err = genPartitionTableFsCust (c , fsCust , rng )
226
+ if err != nil {
227
+ return nil , err
228
+ }
222
229
}
230
+
231
+ // Ensure ext4 rootfs has fs-verity enabled
232
+ rootfs := partitionTable .FindMountable ("/" )
233
+ if rootfs != nil {
234
+ switch elem := rootfs .(type ) {
235
+ case * disk.Filesystem :
236
+ if elem .Type == "ext4" {
237
+ elem .MkfsOptions = append (elem .MkfsOptions , []disk.MkfsOption {disk .MkfsVerity }... )
238
+ }
239
+ }
240
+ }
241
+
242
+ return partitionTable , nil
223
243
}
224
244
225
245
// calcRequiredDirectorySizes will calculate the minimum sizes for /
@@ -421,9 +441,7 @@ func manifestForDiskImage(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest
421
441
mf .Distro = manifest .DISTRO_FEDORA
422
442
runner := & runner.Linux {}
423
443
424
- if err := img .InstantiateManifestFromContainers (& mf ,
425
- []container.SourceSpec {containerSource },
426
- []container.SourceSpec {buildContainerSource }, runner , rng ); err != nil {
444
+ if err := img .InstantiateManifestFromContainers (& mf , []container.SourceSpec {containerSource }, runner , rng ); err != nil {
427
445
return nil , err
428
446
}
429
447
0 commit comments