mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Fix paths and identifiers
This commit is contained in:
parent
ae79877a3f
commit
c6332dda7d
4 changed files with 14 additions and 8 deletions
|
@ -83,7 +83,7 @@ func loadOrFetchFile(identifier string, fetch bool) (*File, error) {
|
|||
}
|
||||
|
||||
// check download dir
|
||||
err := utils.EnsureDirectory(downloadTmpPath, 0755)
|
||||
err := utils.EnsureDirectory(downloadTmpPath, 0700)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not prepare tmp directory for download: %s", err)
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/safing/portbase/database"
|
||||
"github.com/safing/portbase/info"
|
||||
|
@ -15,6 +16,7 @@ import (
|
|||
var (
|
||||
updateStoragePath string
|
||||
downloadTmpPath string
|
||||
isWindows = runtime.GOOS == "windows"
|
||||
)
|
||||
|
||||
// SetDatabaseRoot tells the updates module where the database is - and where to put its stuff.
|
||||
|
@ -66,7 +68,7 @@ func start() error {
|
|||
|
||||
err = UpdateIndexes()
|
||||
if err != nil {
|
||||
return err
|
||||
log.Errorf("updates: failed to download update index: %s", err)
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
|
|
|
@ -12,21 +12,25 @@ const coreIdentifier = "core/portmaster-core"
|
|||
var lastNotified time.Time
|
||||
|
||||
func updateNotifier() {
|
||||
time.Sleep(30 * time.Second)
|
||||
time.Sleep(5 * time.Minute)
|
||||
for {
|
||||
ident := coreIdentifier
|
||||
if isWindows {
|
||||
ident += ".exe"
|
||||
}
|
||||
|
||||
_, version, _, ok := getLatestFilePath(coreIdentifier)
|
||||
if ok {
|
||||
file, err := GetLocalPlatformFile(ident)
|
||||
if err == nil {
|
||||
status.Lock()
|
||||
liveVersion := status.Core.Version
|
||||
status.Unlock()
|
||||
|
||||
if version != liveVersion {
|
||||
if file.Version() != liveVersion {
|
||||
|
||||
// create notification
|
||||
(¬ifications.Notification{
|
||||
ID: "updates-core-update-available",
|
||||
Message: fmt.Sprintf("There is an update available for the Portmaster core (v%s), please restart the Portmaster to apply the update.", version),
|
||||
Message: fmt.Sprintf("There is an update available for the Portmaster core (v%s), please restart the Portmaster to apply the update.", file.Version()),
|
||||
Type: notifications.Info,
|
||||
Expires: time.Now().Add(1 * time.Minute).Unix(),
|
||||
}).Init().Save()
|
||||
|
|
|
@ -153,7 +153,7 @@ func DownloadUpdates() (err error) {
|
|||
log.Tracef("updates: finished updating existing files")
|
||||
|
||||
// remove tmp folder after we are finished
|
||||
err = os.RemoveAll(updateStoragePath)
|
||||
err = os.RemoveAll(downloadTmpPath)
|
||||
if err != nil {
|
||||
log.Tracef("updates: failed to remove tmp dir %s after downloading updates: %s", updateStoragePath, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue