make docker compile on freebsd
Signed-off-by: Alexey Guskov <lexag@mail.ru>
This commit is contained in:
parent
0dc55c7057
commit
4e30080c64
8 changed files with 79 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build linux freebsd
|
||||||
|
|
||||||
package directory
|
package directory
|
||||||
|
|
18
parsers/operatingsystem/operatingsystem_freebsd.go
Normal file
18
parsers/operatingsystem/operatingsystem_freebsd.go
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package operatingsystem
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetOperatingSystem gets the name of the current operating system.
|
||||||
|
func GetOperatingSystem() (string, error) {
|
||||||
|
// TODO: Implement OS detection
|
||||||
|
return "", errors.New("Cannot detect OS version")
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsContainerized returns true if we are running inside a container.
|
||||||
|
// No-op on FreeBSD, always returns false.
|
||||||
|
func IsContainerized() (bool, error) {
|
||||||
|
// TODO: Implement jail detection
|
||||||
|
return false, errors.New("Cannot detect if we are in container")
|
||||||
|
}
|
23
reexec/command_freebsd.go
Normal file
23
reexec/command_freebsd.go
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// +build freebsd
|
||||||
|
|
||||||
|
package reexec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Self returns the path to the current process's binary.
|
||||||
|
// Uses os.Args[0].
|
||||||
|
func Self() string {
|
||||||
|
return naiveSelf()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Command returns *exec.Cmd which have Path as current binary.
|
||||||
|
// For example if current binary is "docker" at "/usr/bin/", then cmd.Path will
|
||||||
|
// be set to "/usr/bin/docker".
|
||||||
|
func Command(args ...string) *exec.Cmd {
|
||||||
|
return &exec.Cmd{
|
||||||
|
Path: Self(),
|
||||||
|
Args: args,
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !linux,!windows
|
// +build !linux,!windows,!freebsd
|
||||||
|
|
||||||
package reexec
|
package reexec
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build linux freebsd
|
||||||
|
|
||||||
package sockets
|
package sockets
|
||||||
|
|
||||||
|
|
7
sysinfo/sysinfo_freebsd.go
Normal file
7
sysinfo/sysinfo_freebsd.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package sysinfo
|
||||||
|
|
||||||
|
// TODO FreeBSD
|
||||||
|
func New(quiet bool) *SysInfo {
|
||||||
|
sysInfo := &SysInfo{}
|
||||||
|
return sysInfo
|
||||||
|
}
|
27
system/stat_freebsd.go
Normal file
27
system/stat_freebsd.go
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
// fromStatT converts a syscall.Stat_t type to a system.Stat_t type
|
||||||
|
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
||||||
|
return &Stat_t{size: s.Size,
|
||||||
|
mode: uint32(s.Mode),
|
||||||
|
uid: s.Uid,
|
||||||
|
gid: s.Gid,
|
||||||
|
rdev: uint64(s.Rdev),
|
||||||
|
mtim: s.Mtimespec}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stat takes a path to a file and returns
|
||||||
|
// a system.Stat_t type pertaining to that file.
|
||||||
|
//
|
||||||
|
// Throws an error if the file does not exist
|
||||||
|
func Stat(path string) (*Stat_t, error) {
|
||||||
|
s := &syscall.Stat_t{}
|
||||||
|
if err := syscall.Stat(path, s); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return fromStatT(s)
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !linux,!windows
|
// +build !linux,!windows,!freebsd
|
||||||
|
|
||||||
package system
|
package system
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue