mirror of
https://github.com/rancher/os.git
synced 2025-08-01 23:17:50 +00:00
move the new cli to 'os' - its very experimental atm
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
parent
dc540a0cf0
commit
2cd6ec4db6
@ -35,6 +35,31 @@ func Main() {
|
||||
return nil
|
||||
}
|
||||
|
||||
//factory := &service.ProjectFactory{}
|
||||
|
||||
app.Commands = []cli.Command{}
|
||||
app.Commands = append(app.Commands, originalCli...)
|
||||
app.Commands = append(app.Commands, hiddenInternalCommands...)
|
||||
|
||||
app.Run(os.Args)
|
||||
}
|
||||
|
||||
func NewMain() {
|
||||
log.InitLogger()
|
||||
app := cli.NewApp()
|
||||
|
||||
app.Name = os.Args[0]
|
||||
app.Usage = "Control and configure RancherOS"
|
||||
app.Version = config.Version
|
||||
app.Author = "Rancher Labs, Inc."
|
||||
app.EnableBashCompletion = true
|
||||
app.Before = func(c *cli.Context) error {
|
||||
if os.Geteuid() != 0 {
|
||||
log.Fatalf("%s: Need to be root", os.Args[0])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
factory := &service.ProjectFactory{}
|
||||
|
||||
app.Commands = []cli.Command{
|
||||
@ -144,14 +169,6 @@ func Main() {
|
||||
HideHelp: true,
|
||||
Action: dummy,
|
||||
},
|
||||
// old..
|
||||
{
|
||||
Name: "old",
|
||||
ShortName: "o",
|
||||
Usage: "old Command line (deprecated, will be removed in future)",
|
||||
HideHelp: true,
|
||||
Subcommands: originalCli,
|
||||
},
|
||||
}
|
||||
app.Commands = append(app.Commands, hiddenInternalCommands...)
|
||||
|
||||
|
1
cmd/control/entrypoint.go
Normal file → Executable file
1
cmd/control/entrypoint.go
Normal file → Executable file
@ -103,6 +103,7 @@ func setupCommandSymlinks() {
|
||||
{config.RosBin, "/sbin/reboot"},
|
||||
{config.RosBin, "/sbin/halt"},
|
||||
{config.RosBin, "/sbin/shutdown"},
|
||||
{config.RosBin, "/sbin/os"},
|
||||
} {
|
||||
if err := os.Symlink(link.oldname, link.newname); err != nil {
|
||||
log.Error(err)
|
||||
|
2
main.go
2
main.go
@ -39,6 +39,8 @@ var entrypoints = map[string]func(){
|
||||
"cni-glue": glue.Main,
|
||||
"bridge": bridge.Main,
|
||||
"host-local": hostlocal.Main,
|
||||
// new CLI
|
||||
"os": control.NewMain,
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -24,6 +24,7 @@ docker run --rm -it \
|
||||
-v $(pwd)/bin/ros:/usr/bin/ros \
|
||||
-v /etc/ssl/certs:/etc/ssl/certs \
|
||||
-v /usr/share/ca-certificates:/usr/share/ca-certificates \
|
||||
-v $(pwd)/bin/ros:/usr/bin/os \
|
||||
-w /var/lib/rancher \
|
||||
--entrypoint sh \
|
||||
rancher/os-base:v0.8.1
|
||||
|
@ -3,7 +3,7 @@ set -e
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
IMAGES=$(bin/host_ros old c images -i build/initrd/usr/share/ros/os-config.yml)
|
||||
IMAGES=$(bin/host_ros c images -i build/initrd/usr/share/ros/os-config.yml)
|
||||
for i in $IMAGES; do
|
||||
if [ "${FORCE_PULL}" = "1" ] || ! docker inspect $i >/dev/null 2>&1; then
|
||||
docker pull $i
|
||||
|
@ -7,4 +7,4 @@ cd $(dirname $0)/..
|
||||
|
||||
OUTPUT=build/initrd/usr/share/ros
|
||||
mkdir -p $OUTPUT
|
||||
./bin/host_ros old c generate < os-config.tpl.yml > $OUTPUT/os-config.yml
|
||||
./bin/host_ros c generate < os-config.tpl.yml > $OUTPUT/os-config.yml
|
||||
|
Loading…
Reference in New Issue
Block a user