Add arch property to jailhost
This commit is contained in:
parent
be756edea7
commit
74602dc0df
@ -179,6 +179,15 @@ func getHostId() (string, error) {
|
||||
return strings.Split(string(content), "\n")[0], nil
|
||||
}
|
||||
|
||||
func getArch() (string, error) {
|
||||
out, err := executeCommand("/usr/bin/uname -p")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Error executing \"/usr/bin/uname -p\": %v", err)
|
||||
}
|
||||
|
||||
return strings.Split(out, "\n")[0], nil
|
||||
}
|
||||
|
||||
func getFreeBSDVersion() (FreeBSDVersion, error) {
|
||||
var version FreeBSDVersion
|
||||
regex := `([0-9]{1,2})(\.)?([0-9]{1,2})?\-([^\-]*)(\-)?(p[0-9]{1,2})?`
|
||||
@ -219,6 +228,9 @@ func NewJailHost() (JailHost, error) {
|
||||
if jh.hostname, err = getHostname(); err != nil {
|
||||
return jh, err
|
||||
}
|
||||
if jh.arch, err = getArch(); err != nil {
|
||||
return jh, err
|
||||
}
|
||||
if jh.hostid, err = getHostId(); err != nil {
|
||||
return jh, err
|
||||
}
|
||||
|
@ -213,6 +213,7 @@ type FreeBSDVersion struct {
|
||||
type JailHost struct {
|
||||
hostname string
|
||||
hostid string
|
||||
arch string
|
||||
default_gateway4 string
|
||||
default_gateway6 string
|
||||
default_interface string
|
||||
|
Loading…
Reference in New Issue
Block a user