diff --git a/revid/config/config.go b/revid/config/config.go index 69eb2901..2b814481 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -27,6 +27,8 @@ package config import ( "errors" + "fmt" + "os/exec" "time" "bitbucket.org/ausocean/av/codec/codecutil" @@ -447,9 +449,29 @@ func (c *Config) Validate() error { c.PSITime = defaultPSITime } + if c.ShowWindows == true { + os, err := osName() + if err != nil { + return err + } + if os == "Raspbian GNU/Linux" { + c.Logger.Log(logger.Info, "ShowWindows disabled on Raspbian GNU/Linux") + c.ShowWindows = false + } + } + return nil } +func osName() (string, error) { + out, err := exec.Command("grep", "^NAME=", "/etc/os-release").Output() + if err != nil { + return "", fmt.Errorf("could not get OS name: %w", err) + } + + return string(out)[6 : len(out)-2], nil +} + // stringInSlice returns true if want is in slice. func stringInSlice(want string, slice []string) bool { for _, s := range slice {