All checks were successful
release / build-and-upload (push) Successful in 7m2s
Dashboard Live uptimes + Recent runs from stream_sessions; overview.recent_sessions. WireGuard netns resolv.conf + missing-deps WARN. Support donations card. Agent start/stop/update, job_backoff default off, wvkey ensure/venv, phonecap retries, modhost YAML enrich, DRM SetCredentials requires keys.
21 lines
485 B
Go
21 lines
485 B
Go
//go:build unix
|
|
|
|
package agentcmd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// replaceBinary moves the live binary to archive, then moves next into place.
|
|
func replaceBinary(target, next, archive string) error {
|
|
if err := os.Rename(target, archive); err != nil {
|
|
return fmt.Errorf("archive current binary: %w", err)
|
|
}
|
|
if err := os.Rename(next, target); err != nil {
|
|
_ = os.Rename(archive, target)
|
|
return fmt.Errorf("install new binary: %w", err)
|
|
}
|
|
_ = os.Chmod(target, 0o755)
|
|
return nil
|
|
}
|