make pkg/parsers support darwin and solaris
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
83be58f17e
commit
dadbfbe65a
5 changed files with 103 additions and 30 deletions
|
@ -1,18 +1,25 @@
|
|||
// +build freebsd darwin
|
||||
|
||||
package operatingsystem
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// GetOperatingSystem gets the name of the current operating system.
|
||||
func GetOperatingSystem() (string, error) {
|
||||
// TODO: Implement OS detection
|
||||
return "", errors.New("Cannot detect OS version")
|
||||
cmd := exec.Command("uname", "-s")
|
||||
osName, err := cmd.Output()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(osName), nil
|
||||
}
|
||||
|
||||
// IsContainerized returns true if we are running inside a container.
|
||||
// No-op on FreeBSD, always returns false.
|
||||
// No-op on FreeBSD and Darwin, always returns false.
|
||||
func IsContainerized() (bool, error) {
|
||||
// TODO: Implement jail detection
|
||||
// TODO: Implement jail detection for freeBSD
|
||||
return false, errors.New("Cannot detect if we are in container")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue