correctly recover if 'apt install' doesn't work
This commit is contained in:
parent
9b4bbeea80
commit
a02078081e
5
send.go
5
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{"mv", "-f", "/usr/bin/zood", "/usr/bin/zood.last"})
|
||||||
shell.RunRealtime([]string{"apt", "update"})
|
shell.RunRealtime([]string{"apt", "update"})
|
||||||
shell.RunRealtime([]string{"apt", "install", "zood"})
|
shell.RunRealtime([]string{"apt", "install", "zood"})
|
||||||
|
if shell.Exists("/usr/bin/zood") {
|
||||||
shell.RunRealtime([]string{"rm", "-f", "/usr/bin/zood.last"})
|
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)
|
os.Exit(0)
|
||||||
} else if strings.HasPrefix(line, "apt install") {
|
} else if strings.HasPrefix(line, "apt install") {
|
||||||
log.Info("machine install", line)
|
log.Info("machine install", line)
|
||||||
|
|
Loading…
Reference in New Issue