Add Bedrock Linux support

This commit is contained in:
2025-08-23 16:32:14 +03:00
parent 1ee2691b44
commit 5ab8a6ee68
2 changed files with 31 additions and 7 deletions
+12
View File
@@ -0,0 +1,12 @@
#/7;8;8;7
${C1} \\\\\\\\\\\\
\\\ \\\
\\\ \\\
\\\ \\\\\\\\\\\\\\\\\
\\\ \\\
\\\ \\\
\\\ ${C2}______ \\\
\\\ ///
\\\ ///
\\\ ///
\\\////////////////
+17 -5
View File
@@ -1,11 +1,12 @@
package main package main
import ( import (
"github.com/mitchellh/go-ps"
"os" "os"
"os/exec" "os/exec"
"path" "path"
"strings" "strings"
"github.com/mitchellh/go-ps"
) )
type DistroInfo struct { type DistroInfo struct {
@@ -24,13 +25,24 @@ func GetDistroInfo() DistroInfo {
info.LongName = strings.TrimSpace(config.DistroName) info.LongName = strings.TrimSpace(config.DistroName)
info.ShortName = strings.TrimSpace(config.DistroName) info.ShortName = strings.TrimSpace(config.DistroName)
} }
var releaseMap = make(map[string]string)
if _, err := os.Stat("/etc/os-release"); err == nil { // Detect release file location
releaseMap, err = ReadKeyValueFile("/etc/os-release") var releaseFile string
if _, err := os.Stat("/bedrock/etc/os-release"); os.Getenv("BEDROCK_RESTRICT") == "" && err == nil {
// Using Bedrock Linux
releaseFile = "/bedrock/etc/os-release"
} else if _, err := os.Stat("/etc/os-release"); err == nil {
// Using a regular linux distribution
releaseFile = "/etc/os-release"
} else {
return info
}
releaseMap, err := ReadKeyValueFile(releaseFile)
if err != nil { if err != nil {
return info return info
} }
}
if id, ok := releaseMap["ID"]; ok { if id, ok := releaseMap["ID"]; ok {
info.ID = id info.ID = id
} }