From 1924d5b1df8c3edc0660629b03482da8d80e5e7c Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 2 Aug 2026 09:45:51 +0000 Subject: [PATCH] fix: cross-filesystem friendly move with cp+rm fallback, kill deploy nginx --- internal/native/native.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/native/native.go b/internal/native/native.go index bc67f78..20dc6b2 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -106,11 +106,15 @@ func InstallNode(node state.Node, apiToken, apiHost, labels, mode string) error return fmt.Errorf("register: %w\n%s", regErr, string(data)) } - // 8. Move /opt/wallarm → /opt/fw/{name}/wallarm, kill temp nginx - exec.Command("pkill", "-f", filepath.Join(DeployTo, "nginx")).Run() + // 8. Move /opt/wallarm → instanceDir (copy+delete for cross-fs safety) + exec.Command("pkill", "-9", "-f", filepath.Join(DeployTo, "nginx")).Run() os.MkdirAll(filepath.Join(BaseDir, node.Name), 0755) os.RemoveAll(instanceDir) - os.Rename(DeployTo, instanceDir) + if err := os.Rename(DeployTo, instanceDir); err != nil { + // Cross-filesystem fallback + exec.Command("cp", "-a", DeployTo, instanceDir).Run() + os.RemoveAll(DeployTo) + } // 9. Patch paths + fix ELF binaries + systemd svc := "wallarm-node@" + node.Name