fix: trap DEBUG to ensure env.list always exists during setup.sh
This commit is contained in:
parent
8638f198ff
commit
4432855a2d
1 changed files with 10 additions and 2 deletions
|
|
@ -56,9 +56,17 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error {
|
||||||
return fmt.Errorf("extract: %w\n%s", err, string(out))
|
return fmt.Errorf("extract: %w\n%s", err, string(out))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Run setup.sh natively
|
// Run setup.sh with env.list protection
|
||||||
fmt.Printf("[%s] Running setup...\n", node.Name)
|
fmt.Printf("[%s] Running setup...\n", node.Name)
|
||||||
cmd = exec.Command("bash", filepath.Join(DeployTo, "setup.sh"),
|
setupPath := filepath.Join(DeployTo, "setup.sh")
|
||||||
|
// Wrapper: ensure env.list exists before any sed commands touch it
|
||||||
|
wrapper := fmt.Sprintf(`#!/bin/bash
|
||||||
|
trap 'touch %s/env.list 2>/dev/null' DEBUG
|
||||||
|
bash %s "$@"
|
||||||
|
`, DeployTo, setupPath)
|
||||||
|
wrapperPath := filepath.Join(DeployTo, "run-setup.sh")
|
||||||
|
os.WriteFile(wrapperPath, []byte(wrapper), 0755)
|
||||||
|
cmd = exec.Command("bash", wrapperPath,
|
||||||
"--batch", "--token", apiToken, "--cloud", cloudFromHost(apiHost),
|
"--batch", "--token", apiToken, "--cloud", cloudFromHost(apiHost),
|
||||||
"--custom-ngx-build",
|
"--custom-ngx-build",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue