diff --git a/.gitignore b/.gitignore index 8d9d1c42..e0d2b2a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -ocid -ocic +/ocid +/ocic conmon/conmon conmon/conmon.o diff --git a/cmd/server/main.go b/cmd/server/main.go index ddf3e171..9f9731ed 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -12,10 +12,6 @@ import ( "google.golang.org/grpc" ) -const ( - unixDomainSocket = "/var/run/ocid.sock" -) - func main() { app := cli.NewApp() app.Name = "ocic" @@ -27,16 +23,21 @@ func main() { Value: "/var/lib/ocid/sandboxes", Usage: "ocid pod sandbox dir", }, - cli.StringFlag{ - Name: "runtime", - Value: "/usr/bin/runc", - Usage: "OCI runtime path", - }, cli.StringFlag{ Name: "containerdir", Value: "/var/lib/ocid/containers", Usage: "ocid container dir", }, + cli.StringFlag{ + Name: "socket", + Value: "/var/run/ocid.sock", + Usage: "path to ocid socket", + }, + cli.StringFlag{ + Name: "runtime", + Value: "/usr/bin/runc", + Usage: "OCI runtime path", + }, cli.BoolFlag{ Name: "debug", Usage: "enable debug output for logging", @@ -76,13 +77,14 @@ func main() { } app.Action = func(c *cli.Context) error { + socketPath := c.String("socket") // Remove the socket if it already exists - if _, err := os.Stat(unixDomainSocket); err == nil { - if err := os.Remove(unixDomainSocket); err != nil { + if _, err := os.Stat(socketPath); err == nil { + if err := os.Remove(socketPath); err != nil { logrus.Fatal(err) } } - lis, err := net.Listen("unix", unixDomainSocket) + lis, err := net.Listen("unix", socketPath) if err != nil { logrus.Fatalf("failed to listen: %v", err) }