mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-15 23:46:12 +00:00
Add Bedrock Linux support
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
#/7;8;8;7
|
||||||
|
${C1} \\\\\\\\\\\\
|
||||||
|
\\\ \\\
|
||||||
|
\\\ \\\
|
||||||
|
\\\ \\\\\\\\\\\\\\\\\
|
||||||
|
\\\ \\\
|
||||||
|
\\\ \\\
|
||||||
|
\\\ ${C2}______ \\\
|
||||||
|
\\\ ///
|
||||||
|
\\\ ///
|
||||||
|
\\\ ///
|
||||||
|
\\\////////////////
|
||||||
+17
-5
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user