cmd/mkinitfs: drop getHookFiles

This commit is contained in:
Clayton Craft
2023-02-17 14:22:48 -08:00
parent 1eb35cf8ef
commit e8854ff88d

View File

@@ -4,10 +4,8 @@
package main
import (
"bufio"
"errors"
"flag"
"fmt"
"io"
"log"
"os"
@@ -138,35 +136,6 @@ func bootDeploy(workDir string, outDir string) error {
return nil
}
func getHookFiles(filesdir string) (files []string, err error) {
fileInfo, err := os.ReadDir(filesdir)
if err != nil {
return nil, fmt.Errorf("getHookFiles: unable to read hook file dir: %w", err)
}
for _, file := range fileInfo {
path := filepath.Join(filesdir, file.Name())
f, err := os.Open(path)
if err != nil {
return nil, fmt.Errorf("getHookFiles: unable to open hook file: %w", err)
}
defer f.Close()
log.Printf("-- Including files from: %s\n", path)
s := bufio.NewScanner(f)
for s.Scan() {
if filelist, err := misc.GetFiles([]string{s.Text()}, true); err != nil {
return nil, fmt.Errorf("getHookFiles: unable to add file %q required by %q: %w", s.Text(), path, err)
} else {
files = append(files, filelist...)
}
}
if err := s.Err(); err != nil {
return nil, fmt.Errorf("getHookFiles: uname to process hook file %q: %w", path, err)
}
}
return files, nil
}
func getInitfsExtraFiles(devinfo deviceinfo.DeviceInfo) (files []string, err error) {
log.Println("== Generating initramfs extra ==")
binariesExtra := []string{