mirror of
https://github.com/taigrr/go-selfupdate
synced 2025-01-18 04:33:12 -08:00
Updated goupdate
This commit is contained in:
commit
14a25c83a5
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@ -10,10 +10,6 @@
|
|||||||
"Comment": "null-13",
|
"Comment": "null-13",
|
||||||
"Rev": "5d3ddcf53a508cc2f7404eaebf546ef2cb5cdb6e"
|
"Rev": "5d3ddcf53a508cc2f7404eaebf546ef2cb5cdb6e"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"ImportPath": "github.com/inconshreveable/go-update",
|
|
||||||
"Rev": "3f0466666779bd2143f368a207b0641f0ed536e8"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/kr/binarydist",
|
"ImportPath": "github.com/kr/binarydist",
|
||||||
"Rev": "9955b0ab8708602d411341e55fffd7e0700f86bd"
|
"Rev": "9955b0ab8708602d411341e55fffd7e0700f86bd"
|
||||||
|
@ -29,6 +29,7 @@ const (
|
|||||||
const devValidTime = 7 * 24 * time.Hour
|
const devValidTime = 7 * 24 * time.Hour
|
||||||
|
|
||||||
var ErrHashMismatch = errors.New("new file hash mismatch after patch")
|
var ErrHashMismatch = errors.New("new file hash mismatch after patch")
|
||||||
|
var up = update.New()
|
||||||
|
|
||||||
// Update protocol.
|
// Update protocol.
|
||||||
//
|
//
|
||||||
@ -76,7 +77,7 @@ func (u *Updater) getExecRelativeDir(dir string) string {
|
|||||||
func (u *Updater) BackgroundRun() {
|
func (u *Updater) BackgroundRun() {
|
||||||
os.MkdirAll(u.getExecRelativeDir(u.Dir), 0777)
|
os.MkdirAll(u.getExecRelativeDir(u.Dir), 0777)
|
||||||
if u.wantUpdate() {
|
if u.wantUpdate() {
|
||||||
if err := update.SanityCheck(); err != nil {
|
if err := up.CanUpdate(); err != nil {
|
||||||
// fail
|
// fail
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -141,7 +142,7 @@ func (u *Updater) update() error {
|
|||||||
// it can't be renamed if a handle to the file is still open
|
// it can't be renamed if a handle to the file is still open
|
||||||
old.Close()
|
old.Close()
|
||||||
|
|
||||||
err, errRecover := update.FromStream(bytes.NewBuffer(bin))
|
err, errRecover := up.FromStream(bytes.NewBuffer(bin))
|
||||||
if errRecover != nil {
|
if errRecover != nil {
|
||||||
return fmt.Errorf("update and recovery errors: %q %q", err, errRecover)
|
return fmt.Errorf("update and recovery errors: %q %q", err, errRecover)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user