@@ -223,15 +223,35 @@ func genPartitionTable(c *ManifestConfig, customizations *blueprint.Customizatio
223
223
}
224
224
}
225
225
226
+ var partitionTable * disk.PartitionTable
226
227
switch {
227
228
// XXX: move into images library
228
229
case fsCust != nil && diskCust != nil :
229
230
return nil , fmt .Errorf ("cannot combine disk and filesystem customizations" )
230
231
case diskCust != nil :
231
- return genPartitionTableDiskCust (c , diskCust , rng )
232
+ partitionTable , err = genPartitionTableDiskCust (c , diskCust , rng )
233
+ if err != nil {
234
+ return nil , err
235
+ }
232
236
default :
233
- return genPartitionTableFsCust (c , fsCust , rng )
237
+ partitionTable , err = genPartitionTableFsCust (c , fsCust , rng )
238
+ if err != nil {
239
+ return nil , err
240
+ }
234
241
}
242
+
243
+ // Ensure ext4 rootfs has fs-verity enabled
244
+ rootfs := partitionTable .FindMountable ("/" )
245
+ if rootfs != nil {
246
+ switch elem := rootfs .(type ) {
247
+ case * disk.Filesystem :
248
+ if elem .Type == "ext4" {
249
+ elem .MkfsOptions = append (elem .MkfsOptions , []disk.MkfsOption {disk .MkfsVerity }... )
250
+ }
251
+ }
252
+ }
253
+
254
+ return partitionTable , nil
235
255
}
236
256
237
257
// calcRequiredDirectorySizes will calculate the minimum sizes for /
@@ -433,9 +453,7 @@ func manifestForDiskImage(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest
433
453
mf .Distro = manifest .DISTRO_FEDORA
434
454
runner := & runner.Linux {}
435
455
436
- if err := img .InstantiateManifestFromContainers (& mf ,
437
- []container.SourceSpec {containerSource },
438
- []container.SourceSpec {buildContainerSource }, runner , rng ); err != nil {
456
+ if err := img .InstantiateManifestFromContainers (& mf , []container.SourceSpec {containerSource }, runner , rng ); err != nil {
439
457
return nil , err
440
458
}
441
459
0 commit comments