2015-02-17 14:31:37 -07:00
|
|
|
package control
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2016-03-16 17:48:57 +08:00
|
|
|
log "github.com/Sirupsen/logrus"
|
2015-02-17 14:31:37 -07:00
|
|
|
"github.com/codegangsta/cli"
|
2015-10-12 19:50:17 +08:00
|
|
|
"github.com/rancher/os/config"
|
2015-02-17 14:31:37 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func Main() {
|
|
|
|
app := cli.NewApp()
|
|
|
|
|
|
|
|
app.Name = os.Args[0]
|
|
|
|
app.Usage = "Control and configure RancherOS"
|
|
|
|
app.Version = config.VERSION
|
|
|
|
app.Author = "Rancher Labs, Inc."
|
2015-02-22 20:56:25 -07:00
|
|
|
app.EnableBashCompletion = true
|
2016-03-16 17:48:57 +08:00
|
|
|
app.Before = func(c *cli.Context) error {
|
|
|
|
if os.Geteuid() != 0 {
|
|
|
|
log.Fatalf("%s: Need to be root", os.Args[0])
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2015-02-17 14:31:37 -07:00
|
|
|
|
|
|
|
app.Commands = []cli.Command{
|
|
|
|
{
|
|
|
|
Name: "config",
|
|
|
|
ShortName: "c",
|
|
|
|
Usage: "configure settings",
|
2015-03-18 06:23:27 -07:00
|
|
|
HideHelp: true,
|
2015-02-17 14:31:37 -07:00
|
|
|
Subcommands: configSubcommands(),
|
|
|
|
},
|
2015-07-21 12:56:55 +05:00
|
|
|
{
|
|
|
|
Name: "dev",
|
|
|
|
ShortName: "d",
|
|
|
|
Usage: "dev spec",
|
|
|
|
HideHelp: true,
|
|
|
|
SkipFlagParsing: true,
|
|
|
|
Action: devAction,
|
|
|
|
},
|
2015-04-29 15:32:12 +05:00
|
|
|
{
|
2015-06-16 01:58:16 +05:00
|
|
|
Name: "env",
|
|
|
|
ShortName: "e",
|
|
|
|
Usage: "env command",
|
|
|
|
HideHelp: true,
|
|
|
|
SkipFlagParsing: true,
|
|
|
|
Action: envAction,
|
2015-04-29 15:32:12 +05:00
|
|
|
},
|
2015-10-01 15:48:19 -07:00
|
|
|
serviceCommand(),
|
2015-02-17 14:31:37 -07:00
|
|
|
{
|
2015-02-23 12:00:33 -07:00
|
|
|
Name: "os",
|
|
|
|
Usage: "operating system upgrade/downgrade",
|
2015-03-18 06:23:27 -07:00
|
|
|
HideHelp: true,
|
2015-02-20 22:35:42 -08:00
|
|
|
Subcommands: osSubcommands(),
|
2015-02-17 14:31:37 -07:00
|
|
|
},
|
2015-02-21 13:31:10 -08:00
|
|
|
{
|
2015-03-18 05:35:47 -07:00
|
|
|
Name: "tls",
|
2015-02-23 12:00:33 -07:00
|
|
|
Usage: "setup tls configuration",
|
2015-03-18 05:35:47 -07:00
|
|
|
HideHelp: true,
|
2015-02-21 13:31:10 -08:00
|
|
|
Subcommands: tlsConfCommands(),
|
|
|
|
},
|
2015-08-18 19:07:00 +05:00
|
|
|
installCommand,
|
2016-02-22 21:35:15 -08:00
|
|
|
selinuxCommand(),
|
2015-02-17 14:31:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
app.Run(os.Args)
|
|
|
|
}
|