Compare commits
No commits in common. "cd0faaefe5e5d479583c02f6416741ce01383100" and "0ed976a06e9fa6821952648767dc8738a4ccfdd0" have entirely different histories.
cd0faaefe5
...
0ed976a06e
27
utils.go
27
utils.go
@ -419,29 +419,18 @@ func GetInitSystem() string {
|
||||
return strings.TrimSpace(string(out))
|
||||
}
|
||||
|
||||
process, err := ps.FindProcess(1)
|
||||
link, err := os.Readlink("/sbin/init")
|
||||
if err != nil {
|
||||
return ""
|
||||
return "Unknown"
|
||||
}
|
||||
|
||||
// Special cases
|
||||
// OpenRC check
|
||||
if _, err := os.Stat("/usr/sbin/openrc"); err == nil {
|
||||
if path.Base(link) == "systemd" {
|
||||
return "Systemd " + runCommand("systemctl --version | head -1 | awk '{print $2}'")
|
||||
} else if path.Base(link) == "openrc-init" {
|
||||
return "OpenRC " + runCommand("openrc --version | awk '{print $3}'")
|
||||
}
|
||||
|
||||
// Default PID 1 process name checking
|
||||
switch process.Executable() {
|
||||
case "systemd":
|
||||
return "Systemd " + runCommand("systemctl --version | head -n1 | awk '{print $2}'")
|
||||
case "runit":
|
||||
} else if path.Base(link) == "runit-init" {
|
||||
return "Runit"
|
||||
case "dinit":
|
||||
return "Dinit " + runCommand("dinit --version | head -n1 | awk '{print substr($3, 1, length($3)-1)}'")
|
||||
case "enit":
|
||||
return "Enit " + runCommand("enit --version | awk '{print $3}'")
|
||||
default:
|
||||
return process.Executable()
|
||||
} else {
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user