Skip to content

Commit 17b3287

Browse files
author
Mrunal Patel
authored
Merge pull request #746 from dfr/freebsd
Add generator support for FreeBSD
2 parents 6101371 + 6666f24 commit 17b3287

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

generate/generate.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type ExportOptions struct {
4242
// New creates a configuration Generator with the default
4343
// configuration for the target operating system.
4444
func New(os string) (generator Generator, err error) {
45-
if os != "linux" && os != "solaris" && os != "windows" {
45+
if os != "linux" && os != "solaris" && os != "windows" && os != "freebsd" {
4646
return generator, fmt.Errorf("no defaults configured for %s", os)
4747
}
4848

@@ -72,7 +72,7 @@ func New(os string) (generator Generator, err error) {
7272
}
7373
}
7474

75-
if os == "linux" || os == "solaris" {
75+
if os == "linux" || os == "solaris" || os == "freebsd" {
7676
config.Process.User = rspec.User{}
7777
config.Process.Env = []string{
7878
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
@@ -237,6 +237,21 @@ func New(os string) (generator Generator, err error) {
237237
},
238238
Seccomp: seccomp.DefaultProfile(&config),
239239
}
240+
} else if os == "freebsd" {
241+
config.Mounts = []rspec.Mount{
242+
{
243+
Destination: "/dev",
244+
Type: "devfs",
245+
Source: "devfs",
246+
Options: []string{"ruleset=4"},
247+
},
248+
{
249+
Destination: "/dev/fd",
250+
Type: "fdescfs",
251+
Source: "fdesc",
252+
Options: []string{},
253+
},
254+
}
240255
}
241256

242257
envCache := map[string]int{}

0 commit comments

Comments
 (0)