diff --git a/config.go b/config.go index d9e9a3e..751d2e1 100644 --- a/config.go +++ b/config.go @@ -19,6 +19,7 @@ type hcloudConfig struct { type flatcarConfig struct { InstallScript string `toml:"install_script"` InstallArgs string `toml:"install_args"` + InstallDevice string `toml:"install_device"` Version string ConfigTemplate string `toml:"config_template"` TemplateStatic map[string]string `toml:"template_static"` diff --git a/main.go b/main.go index 4b4c59d..00e1df7 100644 --- a/main.go +++ b/main.go @@ -381,12 +381,21 @@ func main() { log.Fatalf("error uploading ignition file: %v\n", err) } + // build flatcar-install command + var installDeviceArg string + if cfg.Flatcar.InstallDevice == "" { + installDeviceArg = "-s" + } else { + installDeviceArg = fmt.Sprintf("-d %s", cfg.Flatcar.InstallDevice) + } + installCommand := fmt.Sprintf("%s -i %s -V %s %s %s", installScriptTarget, ignitionTarget, cfg.Flatcar.Version, installDeviceArg, cfg.Flatcar.InstallArgs) + // execute commands to finally install flatcar commands := []string{ "apt update", "apt install -y gawk", fmt.Sprintf("chmod +x %s", installScriptTarget), - fmt.Sprintf("%s -s -i %s -V %s %s", installScriptTarget, ignitionTarget, cfg.Flatcar.Version, cfg.Flatcar.InstallArgs), + installCommand, "shutdown -r now", } for _, command := range commands {