main: remove checksumFile
This was left over from when I was trying to use the 'crc' cpio format, that allows checksumming files in the cpio for checking integrity. The 'crc' format isn't actually supported by the kernel... See: https://lore.kernel.org/linux-doc/20210721115153.28620-2-ddiss@suse.de/
This commit is contained in:
23
main.go
23
main.go
@@ -6,10 +6,8 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"debug/elf"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@@ -85,26 +83,6 @@ func exists(file string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func checksumFile(file string) (string, error) {
|
||||
checksum := ""
|
||||
|
||||
fd, err := os.Open(file)
|
||||
if err != nil {
|
||||
return checksum, err
|
||||
}
|
||||
defer fd.Close()
|
||||
// Castagnoli's polynomial
|
||||
polyTable := crc32.MakeTable(0x82f63b78)
|
||||
hash := crc32.New(polyTable)
|
||||
if _, err := io.Copy(hash, fd); err != nil {
|
||||
return checksum, err
|
||||
}
|
||||
hashBytes := hash.Sum(nil)[:]
|
||||
checksum = hex.EncodeToString(hashBytes)
|
||||
|
||||
return checksum, nil
|
||||
}
|
||||
|
||||
func getHookFiles(filesdir string) misc.StringSet {
|
||||
fileInfo, err := ioutil.ReadDir(filesdir)
|
||||
if err != nil {
|
||||
@@ -598,6 +576,7 @@ func generateInitfs(name string, path string, kernVer string, devinfo deviceinfo
|
||||
if err := getInitfsModules(initfsArchive.Files, devinfo, kernVer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// init.sh is generated
|
||||
initshTempDir, err := ioutil.TempDir("", "initfs")
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user