2014-02-20 00:40:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
2014-03-04 05:47:03 +00:00
|
|
|
|
2014-06-04 23:46:30 +00:00
|
|
|
"github.com/codegangsta/cli"
|
2014-02-20 00:40:36 +00:00
|
|
|
)
|
|
|
|
|
2014-06-05 21:28:09 +00:00
|
|
|
var logPath = os.Getenv("log")
|
2014-02-20 04:35:04 +00:00
|
|
|
|
2014-06-05 21:28:09 +00:00
|
|
|
func preload(context *cli.Context) error {
|
2014-06-04 23:46:30 +00:00
|
|
|
if logPath != "" {
|
2014-06-05 21:28:09 +00:00
|
|
|
if err := openLog(logPath); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2014-05-24 01:06:14 +00:00
|
|
|
}
|
|
|
|
|
2014-06-04 23:46:30 +00:00
|
|
|
return nil
|
2014-02-20 04:35:04 +00:00
|
|
|
}
|
2014-05-14 08:56:55 +00:00
|
|
|
|
2014-06-04 23:46:30 +00:00
|
|
|
func main() {
|
|
|
|
app := cli.NewApp()
|
|
|
|
app.Name = "nsinit"
|
|
|
|
app.Version = "0.1"
|
|
|
|
app.Author = "libcontainer maintainers"
|
2014-05-30 00:23:18 +00:00
|
|
|
|
2014-06-04 23:46:30 +00:00
|
|
|
app.Before = preload
|
|
|
|
app.Commands = []cli.Command{
|
|
|
|
execCommand,
|
|
|
|
initCommand,
|
|
|
|
statsCommand,
|
|
|
|
specCommand,
|
2014-06-05 21:28:09 +00:00
|
|
|
nsenterCommand,
|
2014-05-30 00:23:18 +00:00
|
|
|
}
|
|
|
|
|
2014-06-04 23:46:30 +00:00
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
|
|
log.Fatal(err)
|
2014-05-30 00:23:18 +00:00
|
|
|
}
|
|
|
|
}
|