1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 07:15:41 +00:00
Files
os/cmd/ros-installer/main.go

38 lines
781 B
Go
Raw Normal View History

2021-08-31 11:14:03 -07:00
package main
import (
"flag"
2021-10-13 16:00:29 -07:00
"os"
2021-08-31 11:14:03 -07:00
2021-10-13 16:00:29 -07:00
"github.com/rancher/os/pkg/config"
2021-08-31 11:14:03 -07:00
"github.com/rancher/os/pkg/install"
"github.com/sirupsen/logrus"
2021-10-13 16:00:29 -07:00
"sigs.k8s.io/yaml"
2021-08-31 11:14:03 -07:00
)
var (
2021-10-13 16:00:29 -07:00
output = flag.Bool("automatic", false, "Check for and run automatic installation")
printConfig = flag.Bool("print-config", false, "Print effective configuration and exit")
configFile = flag.String("config-file", "", "Config file to use, local file or http/tftp URL")
2021-08-31 11:14:03 -07:00
)
func main() {
flag.Parse()
2021-10-13 16:00:29 -07:00
if *printConfig {
cfg, err := config.ReadConfig(*configFile)
if err != nil {
logrus.Fatal(err)
}
data, err := yaml.Marshal(cfg)
if err != nil {
logrus.Fatal(err)
}
os.Stdout.Write(data)
return
}
if err := install.Run(*output, *configFile); err != nil {
2021-08-31 11:14:03 -07:00
logrus.Fatal(err)
}
}