mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
Windows will lock files being executed but we should be able to rename them. Fixes #2011 RELEASE_NOTES=[BUGFIX] Fix updater on Windows. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
32 lines
768 B
Go
32 lines
768 B
Go
package action
|
|
|
|
import (
|
|
"github.com/gopasspw/gopass/internal/action/exit"
|
|
"github.com/gopasspw/gopass/internal/out"
|
|
"github.com/gopasspw/gopass/internal/updater"
|
|
"github.com/gopasspw/gopass/pkg/ctxutil"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// Update will start the interactive update assistant.
|
|
func (s *Action) Update(c *cli.Context) error {
|
|
_ = s.rem.Reset("update")
|
|
|
|
ctx := ctxutil.WithGlobalFlags(c)
|
|
|
|
if s.version.String() == "0.0.0+HEAD" {
|
|
out.Errorf(ctx, "Can not check version against HEAD")
|
|
|
|
return nil
|
|
}
|
|
|
|
out.Printf(ctx, "⚒ Checking for available updates ...")
|
|
if err := updater.Update(ctx, s.version); err != nil {
|
|
return exit.Error(exit.Unknown, err, "Failed to update gopass: %s", err)
|
|
}
|
|
|
|
out.OKf(ctx, "gopass is up to date")
|
|
|
|
return nil
|
|
}
|