diff options
| -rw-r--r-- | send.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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) |
