diff options
Diffstat (limited to 'distro.go')
| -rw-r--r-- | distro.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/distro.go b/distro.go deleted file mode 100644 index 0269ea1..0000000 --- a/distro.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2024 WIT.COM Inc. - -package main - -import ( - "bufio" - "fmt" - "os" - "runtime" - "strings" -) - -func initDistro() string { - switch runtime.GOOS { - case "windows": - return "windows" - case "macos": - return "macos" - case "linux": - // Detect the Linux distribution - distro := detectDistro() - if distro == "" { - fmt.Println("Unable to detect Linux distribution.") - distro = "fixme" - } - - fmt.Printf("Detected distribution: %s\n", distro) - return distro - default: - return runtime.GOOS - } -} - -// detectDistro returns the Linux distribution name (if possible) -func detectDistro() string { - // Check if we're on Linux - - // Try to read /etc/os-release to determine the distro - file, err := os.Open("/etc/os-release") - if err != nil { - return "" - } - defer file.Close() - - scanner := bufio.NewScanner(file) - for scanner.Scan() { - line := scanner.Text() - if strings.HasPrefix(line, "ID=") { - parts := strings.SplitN(line, "=", 2) - if len(parts) == 2 { - return strings.Trim(parts[1], `"`) - } - } - } - return "" -} |
