mirror of
https://github.com/safing/portmaster
synced 2025-09-04 19:49:15 +00:00
Fix windows file suffix in updater and pmctl
This commit is contained in:
parent
7bbfdf288f
commit
81eee568f2
2 changed files with 18 additions and 3 deletions
11
pmctl/run.go
11
pmctl/run.go
|
@ -93,6 +93,11 @@ func run(identifier string, cmd *cobra.Command, filterDatabaseFlag bool) error {
|
||||||
args = os.Args[3:]
|
args = os.Args[3:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adapt identifier
|
||||||
|
if windows() {
|
||||||
|
identifier += ".exe"
|
||||||
|
}
|
||||||
|
|
||||||
// run
|
// run
|
||||||
for {
|
for {
|
||||||
file, err := getFile(identifier)
|
file, err := getFile(identifier)
|
||||||
|
@ -101,7 +106,7 @@ func run(identifier string, cmd *cobra.Command, filterDatabaseFlag bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check permission
|
// check permission
|
||||||
if runtime.GOOS != "windows" {
|
if !windows() {
|
||||||
info, err := os.Stat(file.Path())
|
info, err := os.Stat(file.Path())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%s failed to get file info on %s: %s", logPrefix, file.Path(), err)
|
return fmt.Errorf("%s failed to get file info on %s: %s", logPrefix, file.Path(), err)
|
||||||
|
@ -179,3 +184,7 @@ func run(identifier string, cmd *cobra.Command, filterDatabaseFlag bool) error {
|
||||||
fmt.Printf("%s %s completed successfully\n", logPrefix, identifier)
|
fmt.Printf("%s %s completed successfully\n", logPrefix, identifier)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func windows() bool {
|
||||||
|
return runtime.GOOS == "windows"
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Safing/portbase/log"
|
"github.com/Safing/portbase/log"
|
||||||
|
@ -23,8 +24,13 @@ func updater() {
|
||||||
|
|
||||||
func CheckForUpdates() error {
|
func CheckForUpdates() error {
|
||||||
|
|
||||||
// be sure that pmctl is part of the "used" updates
|
// ensure core components are updated
|
||||||
_, err := GetLocalFile("pmctl/pmctl")
|
var err error
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
_, err = GetPlatformFile("pmctl/pmctl.exe")
|
||||||
|
} else {
|
||||||
|
_, err = GetPlatformFile("pmctl/pmctl")
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("updates: failed to mark pmctl/pmctl as used to ensure updates: %s", err)
|
log.Errorf("updates: failed to mark pmctl/pmctl as used to ensure updates: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue