We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 398a6d3 commit 50b783aCopy full SHA for 50b783a
initrd/file.go
@@ -61,7 +61,21 @@ func (initrd *file) Name() string {
61
62
// Build implements Initrd.
63
func (initrd *file) Build(_ context.Context) (string, error) {
64
- return initrd.path, nil
+ if initrd.opts.output == initrd.path {
65
+ return "", fmt.Errorf("CPIO archive path is the same as the source path, this is not allowed as it creates corrupted archives")
66
+ }
67
+
68
+ input, err := os.ReadFile(initrd.path)
69
+ if err != nil {
70
+ return "", fmt.Errorf("reading input file: %w", err)
71
72
73
+ err = os.WriteFile(initrd.opts.output, input, 0o644)
74
75
+ return "", fmt.Errorf("writing output file: %w", err)
76
77
78
+ return initrd.opts.output, nil
79
}
80
81
// Options implements Initrd.
0 commit comments