Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2104f9adcb | ||
|
d62180f9d6 | ||
|
b7f02ff970 |
@@ -31,7 +31,7 @@ gofmt linting:
|
|||||||
- apk -q update --repository http://dl-4.alpinelinux.org/alpine/edge/testing
|
- apk -q update --repository http://dl-4.alpinelinux.org/alpine/edge/testing
|
||||||
- apk -q add --repository http://dl-4.alpinelinux.org/alpine/edge/testing go staticcheck
|
- apk -q add --repository http://dl-4.alpinelinux.org/alpine/edge/testing go staticcheck
|
||||||
script:
|
script:
|
||||||
- .ci/check_linting.sh
|
- .gitlab-ci/check_linting.sh
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
|
38
main.go
38
main.go
@@ -156,9 +156,10 @@ func getHookFiles(filesdir string) misc.StringSet {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
s := bufio.NewScanner(f)
|
s := bufio.NewScanner(f)
|
||||||
for s.Scan() {
|
for s.Scan() {
|
||||||
if err := getFile(files, s.Text(), true); err != nil {
|
if !exists(s.Text()) {
|
||||||
log.Fatalf("Unable to find file %q required by %q", s.Text(), path)
|
log.Fatalf("Unable to find file %q required by %q", s.Text(), path)
|
||||||
}
|
}
|
||||||
|
files[s.Text()] = false
|
||||||
}
|
}
|
||||||
if err := s.Err(); err != nil {
|
if err := s.Err(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@@ -242,42 +243,13 @@ func getFiles(files misc.StringSet, newFiles misc.StringSet, required bool) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getFile(files misc.StringSet, file string, required bool) error {
|
func getFile(files misc.StringSet, file string, required bool) error {
|
||||||
// Expand glob expression
|
if !exists(file) {
|
||||||
expanded, _ := filepath.Glob(file)
|
|
||||||
if len(expanded) > 0 && expanded[0] != file {
|
|
||||||
for _, path := range expanded {
|
|
||||||
if err := getFile(files, path, required); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
fileInfo, err := os.Stat(file)
|
|
||||||
if err != nil {
|
|
||||||
if required {
|
if required {
|
||||||
return errors.New("getFile: File does not exist :" + file)
|
return errors.New("getFile: File does not exist :" + file)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileInfo.IsDir() {
|
|
||||||
// Recurse over directory contents
|
|
||||||
err := filepath.Walk(file, func(path string, f os.FileInfo, err error) error {
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if f.IsDir() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return getFile(files, path, required)
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
files[file] = false
|
files[file] = false
|
||||||
|
|
||||||
// get dependencies for binaries
|
// get dependencies for binaries
|
||||||
@@ -286,7 +258,8 @@ func getFile(files misc.StringSet, file string, required bool) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := getBinaryDeps(files, file); err != nil {
|
err := getBinaryDeps(files, file)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +414,6 @@ func getInitfsFiles(files misc.StringSet, devinfo deviceinfo.DeviceInfo) error {
|
|||||||
"/usr/sbin/telnetd": false,
|
"/usr/sbin/telnetd": false,
|
||||||
"/sbin/kpartx": false,
|
"/sbin/kpartx": false,
|
||||||
"/etc/deviceinfo": false,
|
"/etc/deviceinfo": false,
|
||||||
"/usr/bin/unudhcpd": false,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook files & scripts
|
// Hook files & scripts
|
||||||
|
Reference in New Issue
Block a user