From 09221022262778c0f12720bc5aa9d5ed84415bea Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 1 Aug 2026 18:36:11 +0000 Subject: [PATCH] fix: patch setup.sh env.list sed lines to be non-fatal, kill port with ss --- internal/native/native.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/internal/native/native.go b/internal/native/native.go index 29cf23f..bb84573 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -61,17 +61,15 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error { return fmt.Errorf("extract: %w\n%s", err, string(out)) } - // Run setup.sh with env.list protection - fmt.Printf("[%s] Running setup...\n", node.Name) + // 5. Patch setup.sh: make env.list sed commands non-fatal (file gets deleted during nginx test) 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, + exec.Command("sed", "-i", + `s|\(/opt/wallarm/env.list\)|\1 2>/dev/null || true|g`, + setupPath).Run() + + // 6. Run setup.sh + fmt.Printf("[%s] Running setup...\n", node.Name) + cmd = exec.Command("bash", setupPath, "--batch", "--token", apiToken, "--cloud", cloudFromHost(apiHost), "--custom-ngx-build", )