bundle: Ensure files exist before combining

Signed-off-by: Morten Linderud <morten@linderud.pw>
This commit is contained in:
Morten Linderud 2021-06-05 14:33:28 +02:00
parent 32ac267834
commit fb79c38977
No known key found for this signature in database
GPG Key ID: E742683BA08CB2FF
1 changed files with 6 additions and 0 deletions

View File

@ -145,6 +145,12 @@ func Sign(file, output string, enroll bool) error {
}
func CombineFiles(microcode, initramfs string) (*os.File, error) {
for _, file := range []string{microcode, initramfs} {
if _, err := os.Stat(file); err != nil {
return nil, fmt.Errorf("%s: %w", file, errors.Unwrap(err))
}
}
tmpFile, err := os.CreateTemp("/var/tmp", "initramfs-")
if err != nil {
return nil, err