diff --git a/README.md b/README.md index b7d6dfd..121a28a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ import ( "fmt" "net/http" - "github.com/minio/selfupdate" + "github.com/vvair/selfupdate" ) func doUpdate(url string) error { diff --git a/apply.go b/apply.go index a8142fc..a86d1bf 100644 --- a/apply.go +++ b/apply.go @@ -10,7 +10,7 @@ import ( "os" "path/filepath" - "github.com/minio/selfupdate/internal/osext" + "github.com/vvair/selfupdate/internal/osext" ) // Apply performs an update of the current executable or opts.TargetFile, with @@ -124,8 +124,9 @@ func CommitBinary(opts Options) error { _ = os.Remove(oldPath) // move the existing executable to a new file in the same directory + // skip backup if the target file does not exist. err = os.Rename(targetPath, oldPath) - if err != nil { + if err != nil && !os.IsNotExist(err) { return err } diff --git a/apply_test.go b/apply_test.go index 52b1f58..4ab2da7 100644 --- a/apply_test.go +++ b/apply_test.go @@ -12,7 +12,7 @@ import ( "os" "testing" - "github.com/minio/selfupdate/internal/binarydist" + "github.com/vvair/selfupdate/internal/binarydist" ) var ( diff --git a/doc.go b/doc.go index dde4451..7561783 100644 --- a/doc.go +++ b/doc.go @@ -11,7 +11,7 @@ This example shows how to update a program remotely from a URL. "fmt" "net/http" - "github.com/minio/selfupdate" + "github.com/vvair/selfupdate" ) func doUpdate(url string) error { @@ -42,7 +42,7 @@ may be applied by implementing the Patcher interface. "encoding/hex" "io" - "github.com/minio/selfupdate" + "github.com/vvair/selfupdate" ) func updateWithPatch(patch io.Reader) error { @@ -75,7 +75,7 @@ specified as a hex string. "encoding/hex" "io" - "github.com/minio/selfupdate" + "github.com/vvair/selfupdate" ) func updateWithChecksum(binary io.Reader, hexChecksum string) error { @@ -112,7 +112,7 @@ with the private key and distribute the signature along with the selfupdate. "encoding/hex" "io" - "github.com/minio/selfupdate" + "github.com/vvair/selfupdate" ) func verifiedUpdate(binary io.Reader, hexChecksum string) { diff --git a/go.mod b/go.mod index dc90207..8aedc03 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/minio/selfupdate +module github.com/vvair/selfupdate go 1.24.0 diff --git a/patcher.go b/patcher.go index 1bff793..64ebe3a 100644 --- a/patcher.go +++ b/patcher.go @@ -3,7 +3,7 @@ package selfupdate import ( "io" - "github.com/minio/selfupdate/internal/binarydist" + "github.com/vvair/selfupdate/internal/binarydist" ) // Patcher defines an interface for applying binary patches to an old item to get an updated item.