Mount EFI partition as RW, to rotate recovery -> active on reset

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
Dimitris Karakasilis
2024-02-20 18:16:57 +02:00
parent a635a7ba08
commit ca84f82faa
2 changed files with 22 additions and 0 deletions

View File

@@ -523,12 +523,27 @@ func NewUkiResetSpec(cfg *Config) (spec *v1.ResetUkiSpec, err error) {
spec.Partitions.Persistent = partitions.GetPartitionViaDM(cfg.Fs, constants.PersistentLabel)
spec.Partitions.OEM = partitions.GetPartitionViaDM(cfg.Fs, constants.OEMLabel)
// Get EFI partition
parts, err := partitions.GetAllPartitions()
if err != nil {
return spec, fmt.Errorf("could not read host partitions")
}
for _, p := range parts {
if p.FilesystemLabel == constants.EfiLabel {
spec.Partitions.EFI = p
break
}
}
if spec.Partitions.Persistent == nil {
return spec, fmt.Errorf("persistent partition not found")
}
if spec.Partitions.OEM == nil {
return spec, fmt.Errorf("oem partition not found")
}
if spec.Partitions.EFI == nil {
return spec, fmt.Errorf("efi partition not found")
}
// Fill oem partition
err = unmarshallFullSpec(cfg, "reset", spec)