@@ -211,15 +211,35 @@ func genPartitionTable(c *ManifestConfig, customizations *blueprint.Customizatio
211211 if err != nil {
212212 return nil , fmt .Errorf ("error reading disk customizations: %w" , err )
213213 }
214+ var partitionTable * disk.PartitionTable
214215 switch {
215216 // XXX: move into images library
216217 case fsCust != nil && diskCust != nil :
217218 return nil , fmt .Errorf ("cannot combine disk and filesystem customizations" )
218219 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+ }
220224 default :
221- return genPartitionTableFsCust (c , fsCust , rng )
225+ partitionTable , err = genPartitionTableFsCust (c , fsCust , rng )
226+ if err != nil {
227+ return nil , err
228+ }
222229 }
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
223243}
224244
225245// calcRequiredDirectorySizes will calculate the minimum sizes for /
@@ -421,9 +441,7 @@ func manifestForDiskImage(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest
421441 mf .Distro = manifest .DISTRO_FEDORA
422442 runner := & runner.Linux {}
423443
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 {
427445 return nil , err
428446 }
429447
0 commit comments