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)