Skip to content

Commit

Permalink
fix: mark overlay installer executable
Browse files Browse the repository at this point in the history
Fixes #8603

P.S. There's one more issue with architecture mix that needs to be
resolved as well.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Apr 16, 2024
1 parent 3433fa1 commit b1b63f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions pkg/imager/filemap/filemap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
type File struct {
ImagePath string
SourcePath string
ImageMode int64
}

// Walk the filesystem generating a filemap.
Expand Down Expand Up @@ -75,6 +76,7 @@ func build(filemap []File) io.ReadCloser {
if err = w.WriteHeader(&tar.Header{
Name: entry.ImagePath,
Size: st.Size(),
Mode: entry.ImageMode,
}); err != nil {
return err
}
Expand Down
16 changes: 9 additions & 7 deletions pkg/imager/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,31 +427,33 @@ func (i *Imager) outInstaller(ctx context.Context, path string, report *reporter
for _, extraArtifact := range []struct {
sourcePath string
imagePath string
mode os.FileMode
}{
{
sourcePath: filepath.Join(i.tempDir, constants.ImagerOverlayArtifactsPath),
imagePath: constants.ImagerOverlayArtifactsPath,
imagePath: strings.TrimLeft(constants.ImagerOverlayArtifactsPath, "/"),
},
{
sourcePath: filepath.Join(i.tempDir, constants.ImagerOverlayInstallersPath, i.prof.Overlay.Name),
imagePath: constants.ImagerOverlayInstallerDefaultPath,
imagePath: strings.TrimLeft(constants.ImagerOverlayInstallerDefaultPath, "/"),
mode: 0o755,
},
{
sourcePath: filepath.Join(i.tempDir, constants.ImagerOverlayExtraOptionsPath),
imagePath: constants.ImagerOverlayExtraOptionsPath,
imagePath: strings.TrimLeft(constants.ImagerOverlayExtraOptionsPath, "/"),
},
} {
if extraArtifact.sourcePath == "" {
continue
}

var extraFiles []filemap.File

extraFiles, err = filemap.Walk(extraArtifact.sourcePath, extraArtifact.imagePath)
if err != nil {
return fmt.Errorf("failed to walk extra artifact %s: %w", extraArtifact.sourcePath, err)
}

for i := range extraFiles {
extraFiles[i].ImageMode = int64(extraArtifact.mode)
}

overlayArtifacts = append(overlayArtifacts, extraFiles...)
}

Expand Down

0 comments on commit b1b63f6

Please sign in to comment.