Skip to content

Commit 3873641

Browse files
committed
Add install_device option for flatcar install
1 parent ad2d037 commit 3873641

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type hcloudConfig struct {
1919
type flatcarConfig struct {
2020
InstallScript string `toml:"install_script"`
2121
InstallArgs string `toml:"install_args"`
22+
InstallDevice string `toml:"install_device"`
2223
Version string
2324
ConfigTemplate string `toml:"config_template"`
2425
TemplateStatic map[string]string `toml:"template_static"`

main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,21 @@ func main() {
381381
log.Fatalf("error uploading ignition file: %v\n", err)
382382
}
383383

384+
// build flatcar-install command
385+
var installDeviceArg string
386+
if cfg.Flatcar.InstallDevice == "" {
387+
installDeviceArg = "-s"
388+
} else {
389+
installDeviceArg = fmt.Sprintf("-d %s", cfg.Flatcar.InstallDevice)
390+
}
391+
installCommand := fmt.Sprintf("%s -i %s -V %s %s %s", installScriptTarget, ignitionTarget, cfg.Flatcar.Version, installDeviceArg, cfg.Flatcar.InstallArgs)
392+
384393
// execute commands to finally install flatcar
385394
commands := []string{
386395
"apt update",
387396
"apt install -y gawk",
388397
fmt.Sprintf("chmod +x %s", installScriptTarget),
389-
fmt.Sprintf("%s -s -i %s -V %s %s", installScriptTarget, ignitionTarget, cfg.Flatcar.Version, cfg.Flatcar.InstallArgs),
398+
installCommand,
390399
"shutdown -r now",
391400
}
392401
for _, command := range commands {

0 commit comments

Comments
 (0)