From a02078081e445a806cd0d103f452b5154ac4b967 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 23 Mar 2025 18:20:13 -0500 Subject: [PATCH] correctly recover if 'apt install' doesn't work --- send.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/send.go b/send.go index bda922d..2eaf1d5 100644 --- a/send.go +++ b/send.go @@ -68,7 +68,12 @@ func sendMachine(s string) error { shell.RunRealtime([]string{"mv", "-f", "/usr/bin/zood", "/usr/bin/zood.last"}) shell.RunRealtime([]string{"apt", "update"}) shell.RunRealtime([]string{"apt", "install", "zood"}) - shell.RunRealtime([]string{"rm", "-f", "/usr/bin/zood.last"}) + if shell.Exists("/usr/bin/zood") { + shell.RunRealtime([]string{"rm", "-f", "/usr/bin/zood.last"}) + } else { + // there is not a new version of the binary. move the old one back + shell.RunRealtime([]string{"mv", "-f", "/usr/bin/zood.last", "/usr/bin/zood"}) + } os.Exit(0) } else if strings.HasPrefix(line, "apt install") { log.Info("machine install", line)