osbase/build/mkimage/osimage: remove initial slash in EFI paths
Many places where these paths are used don't need the initial slash, and
it's easier to add it than to remove it.
Change-Id: Iec189628556c9aa1c022fdd46a2c9fe57692e0aa
Reviewed-on: https://review.monogon.dev/c/monogon/+/4194
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/osbase/build/mkimage/osimage/osimage.go b/osbase/build/mkimage/osimage/osimage.go
index 4cd3952..4edb077 100644
--- a/osbase/build/mkimage/osimage/osimage.go
+++ b/osbase/build/mkimage/osimage/osimage.go
@@ -8,7 +8,6 @@
import (
"fmt"
"io"
- "strings"
"github.com/google/uuid"
@@ -32,9 +31,9 @@
DataLabel = "METROPOLIS-NODE-DATA"
ESPLabel = "ESP"
- EFIPayloadPath = "/EFI/BOOT/BOOTx64.EFI"
- EFIBootAPath = "/EFI/metropolis/boot-a.efi"
- EFIBootBPath = "/EFI/metropolis/boot-b.efi"
+ EFIPayloadPath = "EFI/BOOT/BOOTx64.EFI"
+ EFIBootAPath = "EFI/metropolis/boot-a.efi"
+ EFIBootBPath = "EFI/metropolis/boot-b.efi"
nodeParamsPath = "metropolis/parameters.pb"
)
@@ -135,7 +134,7 @@
PartitionUUID: i.efiPartition.ID,
},
},
- efivarfs.FilePath(EFIPayloadPath),
+ efivarfs.FilePath("/" + EFIPayloadPath),
},
}, nil
}
@@ -162,11 +161,11 @@
return nil, fmt.Errorf("failed to allocate ESP: %w", err)
}
- if err := params.efiRoot.PlaceFile(strings.TrimPrefix(EFIBootAPath, "/"), params.EFIPayload); err != nil {
+ if err := params.efiRoot.PlaceFile(EFIBootAPath, params.EFIPayload); err != nil {
return nil, err
}
// Place the A/B loader at the EFI bootloader autodiscovery path.
- if err := params.efiRoot.PlaceFile(strings.TrimPrefix(EFIPayloadPath, "/"), params.ABLoader); err != nil {
+ if err := params.efiRoot.PlaceFile(EFIPayloadPath, params.ABLoader); err != nil {
return nil, err
}
if params.NodeParameters != nil {