Fleshed out the framework of most of the wwctl overlay command group.

This commit is contained in:
Gregory Kurtzer
2020-11-17 21:50:27 -08:00
parent 108174d35c
commit ed7dbdaf32
18 changed files with 806 additions and 39 deletions

View File

@@ -92,6 +92,13 @@ func IsDir(path string) (bool) {
return false
}
func IsFile(path string) (bool) {
if _, err := os.Stat(path); err == nil {
return true
}
return false
}
func TaintCheck(pattern string, expr string) bool {
if b, _ := regexp.MatchString(expr, pattern); b == true {
@@ -122,10 +129,18 @@ func FindFiles(path string) []string {
return err
}
if IsDir(location) == false {
wwlog.Printf(wwlog.DEBUG, "FindFiles() found: %s\n", location)
if location == "." {
return nil
}
if IsDir(location) == true {
wwlog.Printf(wwlog.DEBUG, "FindFiles() found directory: %s\n", location)
ret = append(ret, location +"/")
} else {
wwlog.Printf(wwlog.DEBUG, "FindFiles() found file: %s\n", location)
ret = append(ret, location)
}
return nil
})
if err != nil {