mirror of
https://github.com/safing/portmaster
synced 2025-09-03 02:59:13 +00:00
Fix android update system
This commit is contained in:
parent
0562180ba9
commit
7cbabd50c4
4 changed files with 22 additions and 4 deletions
|
@ -10,9 +10,13 @@ func osGetInterfaceAddrs() ([]net.Addr, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var netList []net.Addr
|
var netList []net.Addr
|
||||||
for _, addr := range list {
|
for _, addr := range list {
|
||||||
netList = append(netList, addr.ToIPNet())
|
ipNetAddr, err := addr.ToIPNet()
|
||||||
|
if err == nil {
|
||||||
|
netList = append(netList, ipNetAddr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return netList, nil
|
return netList, nil
|
||||||
|
|
|
@ -59,3 +59,14 @@ func GetVersion(identifier string) (*updater.ResourceVersion, error) {
|
||||||
|
|
||||||
return rv, nil
|
return rv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetVersionWithFullID returns the selected generic version of the given full identifier.
|
||||||
|
// The returned resource version may not be modified.
|
||||||
|
func GetVersionWithFullID(identifier string) (*updater.ResourceVersion, error) {
|
||||||
|
rv, err := registry.GetVersion(identifier)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv, nil
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,9 @@ var (
|
||||||
// more context to requests made by the registry when
|
// more context to requests made by the registry when
|
||||||
// fetching resources from the update server.
|
// fetching resources from the update server.
|
||||||
UserAgent = "Core"
|
UserAgent = "Core"
|
||||||
|
|
||||||
|
// Explicitly disables automatic software updates. Used in android.
|
||||||
|
DisableSoftwareAutoUpdate = false
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -145,7 +148,7 @@ func start() error {
|
||||||
registry,
|
registry,
|
||||||
initialReleaseChannel,
|
initialReleaseChannel,
|
||||||
true,
|
true,
|
||||||
enableSoftwareUpdates(),
|
enableSoftwareUpdates() && !DisableSoftwareAutoUpdate,
|
||||||
enableIntelUpdates(),
|
enableIntelUpdates(),
|
||||||
)
|
)
|
||||||
if warning != nil {
|
if warning != nil {
|
||||||
|
@ -247,7 +250,7 @@ func checkForUpdates(ctx context.Context) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
// Resolve any error and and send succes notification.
|
// Resolve any error and and send success notification.
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Infof("updates: successfully checked for updates")
|
log.Infof("updates: successfully checked for updates")
|
||||||
notifyUpdateSuccess(forcedUpdate)
|
notifyUpdateSuccess(forcedUpdate)
|
||||||
|
|
|
@ -115,7 +115,7 @@ func notifyUpdateCheckFailed(forced bool, err error) {
|
||||||
// Not failed often enough for notification.
|
// Not failed often enough for notification.
|
||||||
return
|
return
|
||||||
case lastSuccess == nil:
|
case lastSuccess == nil:
|
||||||
// No recorded successful udpate.
|
// No recorded successful update.
|
||||||
case time.Now().Add(-failedUpdateNotifyDurationThreshold).Before(*lastSuccess):
|
case time.Now().Add(-failedUpdateNotifyDurationThreshold).Before(*lastSuccess):
|
||||||
// Failed too recently for notification.
|
// Failed too recently for notification.
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue