2014-08-13 01:46:43 +08:00
|
|
|
package main
|
2014-02-20 08:40:36 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
2014-03-04 13:47:03 +08:00
|
|
|
|
2014-06-05 07:46:30 +08:00
|
|
|
"github.com/codegangsta/cli"
|
2014-02-20 08:40:36 +08:00
|
|
|
)
|
|
|
|
|
2014-08-09 02:16:56 +08:00
|
|
|
var (
|
|
|
|
logPath = os.Getenv("log")
|
|
|
|
)
|
|
|
|
|
2014-08-13 01:46:43 +08:00
|
|
|
func main() {
|
2014-06-05 07:46:30 +08:00
|
|
|
app := cli.NewApp()
|
2014-08-09 02:16:56 +08:00
|
|
|
|
2014-06-05 07:46:30 +08:00
|
|
|
app.Name = "nsinit"
|
|
|
|
app.Version = "0.1"
|
|
|
|
app.Author = "libcontainer maintainers"
|
2014-08-05 06:05:50 +08:00
|
|
|
app.Flags = []cli.Flag{
|
|
|
|
cli.StringFlag{Name: "nspid"},
|
2014-08-07 09:44:41 +08:00
|
|
|
cli.StringFlag{Name: "console"},
|
2014-10-23 04:45:23 +08:00
|
|
|
cli.StringFlag{Name: "root", Value: ".", Usage: "root directory for containers"},
|
2014-08-07 09:44:41 +08:00
|
|
|
}
|
|
|
|
|
2014-06-05 07:46:30 +08:00
|
|
|
app.Before = preload
|
2014-08-07 09:44:41 +08:00
|
|
|
|
2014-06-05 07:46:30 +08:00
|
|
|
app.Commands = []cli.Command{
|
2015-01-27 20:54:19 +08:00
|
|
|
configCommand,
|
2014-06-05 07:46:30 +08:00
|
|
|
execCommand,
|
|
|
|
initCommand,
|
2015-01-27 20:54:19 +08:00
|
|
|
oomCommand,
|
2014-06-27 07:44:43 +08:00
|
|
|
pauseCommand,
|
2015-01-27 20:54:19 +08:00
|
|
|
statsCommand,
|
2014-06-27 07:44:43 +08:00
|
|
|
unpauseCommand,
|
2014-05-30 08:23:18 +08:00
|
|
|
}
|
|
|
|
|
2014-06-05 07:46:30 +08:00
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
|
|
log.Fatal(err)
|
2014-05-30 08:23:18 +08:00
|
|
|
}
|
|
|
|
}
|