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

@@ -5,6 +5,7 @@ import (
"io"
"os"
"os/exec"
"runtime"
"strings"
"github.com/spf13/cobra"
@@ -100,11 +101,16 @@ func run(identifier string, cmd *cobra.Command, filterDatabaseFlag bool) error {
}
// check permission
info, err := os.Stat(file.Path())
if info.Mode() != 0755 {
err := os.Chmod(file.Path(), 0755)
if runtime.GOOS != "windows" {
info, err := os.Stat(file.Path())
if err != nil {
return fmt.Errorf("%s failed to set exec permissions on %s: %s", logPrefix, file.Path(), err)
return fmt.Errorf("%s failed to get file info on %s: %s", logPrefix, file.Path(), err)
}
if info.Mode() != 0755 {
err := os.Chmod(file.Path(), 0755)
if err != nil {
return fmt.Errorf("%s failed to set exec permissions on %s: %s", logPrefix, file.Path(), err)
}
}
}

View File

@@ -5,6 +5,7 @@ import (
"io"
"os"
"path/filepath"
"runtime"
"github.com/Safing/portbase/info"
"github.com/Safing/portmaster/updates"
@@ -51,14 +52,18 @@ func doSelfUpgrade(file *updates.File) error {
}
// check permission
info, err := os.Stat(dst)
if info.Mode() != 0755 {
err := os.Chmod(dst, 0755)
if runtime.GOOS != "windows" {
info, err := os.Stat(dst)
if err != nil {
return fmt.Errorf("failed to set permissions on %s: %s", dst, err)
return fmt.Errorf("failed to get file info on %s: %s", dst, err)
}
if info.Mode() != 0755 {
err := os.Chmod(dst, 0755)
if err != nil {
return fmt.Errorf("failed to set permissions on %s: %s", dst, err)
}
}
}
return nil
}