This commit is contained in:
parent
7a3a156b4f
commit
04ab271e9a
|
@ -12,6 +12,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/hashicorp/go-getter"
|
||||
"github.com/otiai10/copy"
|
||||
)
|
||||
|
||||
// DoUpgrade will be called after the log message has been parsed and the process has terminated.
|
||||
|
@ -62,10 +63,19 @@ func DownloadBinary(cfg *Config, info *UpgradeInfo) error {
|
|||
if err != nil {
|
||||
dirPath := cfg.UpgradeDir(info.Name)
|
||||
err = getter.Get(dirPath, url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = EnsureBinary(binPath)
|
||||
// copy binary to binPath from dirPath if zipped directory don't contain bin directory to wrap the binary
|
||||
if err != nil {
|
||||
err = copy.Copy(filepath.Join(dirPath, cfg.Name), binPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// if it is successful, let's ensure the binary is executable
|
||||
return MarkExecutable(binPath)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue