mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
all: use correct binary path when running upgrade
For safety reason, ctrld will create a backup of the current binary when running upgrade command. However, on systems where ctrld status is got by parsing ps command output, the current binary path is important and must be the same with the original binary. Depends on kernel version, using os.Executable may return new backup binary path, aka "ctrld_previous", not the original "ctrld" binary. This causes upgrade command see ctrld as not running after restart -> upgrade failed. Fixing this by recording the binary path before creating new service, so the ctrld service status can be checked correctly.
This commit is contained in:
committed by
Cuong Manh Le
parent
5710f2e984
commit
486096416f
@@ -49,11 +49,15 @@ func (s *merlinSvc) Platform() string {
|
||||
}
|
||||
|
||||
func (s *merlinSvc) configPath() string {
|
||||
path, err := os.Executable()
|
||||
if err != nil {
|
||||
return ""
|
||||
bin := s.Config.Executable
|
||||
if bin == "" {
|
||||
path, err := os.Executable()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
bin = path
|
||||
}
|
||||
return path + ".startup"
|
||||
return bin + ".startup"
|
||||
}
|
||||
|
||||
func (s *merlinSvc) template() *template.Template {
|
||||
|
||||
Reference in New Issue
Block a user