Add windowskext integration, update related packages

This commit is contained in:
Daniel
2019-04-26 11:33:24 +02:00
parent a702cd4824
commit 78a0b3c1fb
33 changed files with 979 additions and 690 deletions

View File

@@ -9,6 +9,7 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"time"
"github.com/google/renameio"
@@ -70,9 +71,11 @@ func fetchFile(realFilepath, updateFilepath string, tries int) error {
return fmt.Errorf("updates: failed to finalize file %s: %s", realFilepath, err)
}
// set permissions
err = os.Chmod(realFilepath, 0644)
if err != nil {
log.Warningf("updates: failed to set permissions on downloaded file %s: %s", realFilepath, err)
if runtime.GOOS != "windows" {
err = os.Chmod(realFilepath, 0644)
if err != nil {
log.Warningf("updates: failed to set permissions on downloaded file %s: %s", realFilepath, err)
}
}
log.Infof("updates: fetched %s (stored to %s)", downloadURL, realFilepath)

View File

@@ -56,7 +56,7 @@ func loadOrFetchFile(identifier string) (*File, error) {
}
// build final filepath
realFilePath := filepath.Join(updateStoragePath, versionedFilePath)
realFilePath := filepath.Join(updateStoragePath, filepath.FromSlash(versionedFilePath))
if _, err := os.Stat(realFilePath); err == nil {
// file exists
updateUsedStatus(identifier, version)

View File

@@ -92,6 +92,7 @@ func ScanForLatest(baseDir string, hardFail bool) (latest map[string]string, las
storedVersion, ok := latest[identifierPath]
if ok {
// FIXME: this will fail on multi-digit version segments!
// FIXME: use https://github.com/hashicorp/go-version
if version > storedVersion {
latest[identifierPath] = version
}