Merge remote-tracking branch 'origin/fix/geoip-db-handling' into feature/installer-migration

This commit is contained in:
Alexandr Stelnykovych 2025-03-21 15:40:35 +02:00
commit 9437a95645
2 changed files with 9 additions and 9 deletions
service
intel/geoip
updates

View file

@ -56,15 +56,8 @@ func (ub *updateBroadcaster) AvailableUpdate() *updates.Artifact {
// Get artifact.
artifact, err := module.instance.IntelUpdates().GetFile(ub.dbName)
if err != nil {
// Check if the geoip database is included in the binary index instead.
// TODO: Remove when intelhub builds the geoip database.
if artifact2, err2 := module.instance.BinaryUpdates().GetFile(ub.dbName); err2 == nil {
artifact = artifact2
err = nil
} else {
log.Warningf("geoip: failed to get geoip update: %s", err)
return nil
}
log.Warningf("geoip: failed to get geoip update: %s", err)
return nil
}
// Return artifact if not yet initialized.

View file

@ -16,6 +16,7 @@ import (
"github.com/safing/jess"
"github.com/safing/portmaster/base/log"
"github.com/safing/portmaster/base/notifications"
"github.com/safing/portmaster/base/utils"
"github.com/safing/portmaster/service/mgr"
)
@ -170,6 +171,12 @@ func New(instance instance, name string, cfg Config) (*Updater, error) {
return nil, fmt.Errorf("config is invalid: %w", err)
}
// Make sure main dir exists.
err := utils.EnsureDirectory(module.cfg.Directory, utils.PublicReadExecPermission)
if err != nil {
return nil, fmt.Errorf("create update target directory: %s", module.cfg.DownloadDirectory)
}
// Create Workers.
module.updateCheckWorkerMgr = m.NewWorkerMgr("update checker", module.updateCheckWorker, nil)
module.upgradeWorkerMgr = m.NewWorkerMgr("upgrader", module.upgradeWorker, nil)