Skip to content

Commit

Permalink
fix: trim file path in the container image
Browse files Browse the repository at this point in the history
When imager generates `installer` image, it should generate a layer
without `/` in front, e.g. `/usr/install` -> `usr/install`.

It works either way, but this seems to be cleaner.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Sep 6, 2023
1 parent 3d2dad4 commit 5e11f08
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/imager/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"log"
"os"
"path/filepath"
"strings"
"time"

"github.com/google/go-containerregistry/pkg/name"
Expand Down Expand Up @@ -260,22 +261,22 @@ func (i *Imager) outInstaller(ctx context.Context, path string, report *reporter
if i.prof.SecureBootEnabled() {
artifacts = append(artifacts,
filemap.File{
ImagePath: fmt.Sprintf(constants.UKIAssetPath, i.prof.Arch),
ImagePath: strings.TrimLeft(fmt.Sprintf(constants.UKIAssetPath, i.prof.Arch), "/"),
SourcePath: i.ukiPath,
},
filemap.File{
ImagePath: fmt.Sprintf(constants.SDBootAssetPath, i.prof.Arch),
ImagePath: strings.TrimLeft(fmt.Sprintf(constants.SDBootAssetPath, i.prof.Arch), "/"),
SourcePath: i.sdBootPath,
},
)
} else {
artifacts = append(artifacts,
filemap.File{
ImagePath: fmt.Sprintf(constants.KernelAssetPath, i.prof.Arch),
ImagePath: strings.TrimLeft(fmt.Sprintf(constants.KernelAssetPath, i.prof.Arch), "/"),
SourcePath: i.prof.Input.Kernel.Path,
},
filemap.File{
ImagePath: fmt.Sprintf(constants.InitramfsAssetPath, i.prof.Arch),
ImagePath: strings.TrimLeft(fmt.Sprintf(constants.InitramfsAssetPath, i.prof.Arch), "/"),
SourcePath: i.initramfsPath,
},
)
Expand Down

0 comments on commit 5e11f08

Please sign in to comment.