Slightly kludgy workaround for gtk-3.20 dependence in gtk-3.18 builds.

Added SGFW_CONF environment variable for overriding default SGFW configuration path.
Added SGFW_SOCKS_CONFIG environment variable for overriding default SGFW SOCKS json config file path.
Updated readme with information on building outside SGOS.
shw-merge
Stephen Watt 7 years ago
parent 92276eed47
commit a3fa1b1285

@ -1,3 +1,15 @@
*** Please also refer to the notes found in fw-prompt/README.txt: you will need to copy both files in sources/etc/dbus-1/system.d/ into /etc/dbus-1/system.d/
Build complications:
You may need to run the following first, esp. on Ubuntu 16.04:
go install -tags gtk_3_18 github.com/gotk3/gotk3/gtk
and build with the following:
go build -v -tags gtk_3_18 -gcflags "-N -l" fw-prompt
Otherwise standard go build and go install procedures should suffice.
Before running fw-daemon, make sure to export: GODEBUG=cgocheck=0
Also, here's a default fw-daemon-socks.json config file:

@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"regexp"
"reflect"
"github.com/gotk3/gotk3/glib"
@ -35,6 +36,19 @@ func builderForDefinition(uiName string) *gtk.Builder {
template := getDefinitionWithFileFallback(uiName)
maj := gtk.GetMajorVersion()
min := gtk.GetMinorVersion()
if ((maj == 3) && (min < 20)) {
fmt.Fprintf(os.Stderr,
"Attempting runtime work-around for older versions of libgtk-3...\n");
dep_re := regexp.MustCompile(`<\s?property\s+name\s?=\s?"icon_size"\s?>.+<\s?/property\s?>`)
template = dep_re.ReplaceAllString(template, ``)
dep_re2 := regexp.MustCompile(`version\s?=\s?"3.20"`)
template = dep_re2.ReplaceAllString(template, `version="3.18"`)
}
builder, err := gtk.BuilderNew()
if err != nil {
//We cant recover from this

@ -27,7 +27,13 @@ type FirewallConfigs struct {
var FirewallConfig FirewallConfigs
func _readConfig(file string) []byte {
f, err := os.Open(configDefaultPath)
envFile := os.Getenv("SGFW_CONF")
if envFile != "" {
file = envFile
}
f, err := os.Open(file)
if err != nil {
log.Warning(err.Error())
return []byte{}

@ -53,11 +53,11 @@ func (p *prompter) prompt(policy *Policy) {
func (p *prompter) promptLoop() {
p.lock.Lock()
for {
fmt.Println("promptLoop() outer")
// fmt.Println("XXX: promptLoop() outer")
for p.processNextPacket() {
fmt.Println("promptLoop() inner")
// fmt.Println("XXX: promptLoop() inner")
}
fmt.Println("promptLoop() wait")
// fmt.Println("promptLoop() wait")
p.cond.Wait()
}
}

@ -241,7 +241,13 @@ func Main() {
wg := sync.WaitGroup{}
config, err := loadSocksConfiguration(defaultSocksCfgPath)
scfile := os.Getenv("SGFW_SOCKS_CONFIG")
if scfile == "" {
scfile = defaultSocksCfgPath
}
config, err := loadSocksConfiguration(scfile)
if err != nil && !os.IsNotExist(err) {
panic(err)
}
@ -250,7 +256,7 @@ func Main() {
chain := NewSocksChain(socksConfig, &wg, fw)
chain.start()
} else {
log.Notice("Did not find SOCKS5 configuration file at", defaultSocksCfgPath, "; ignoring subsystem...")
log.Notice("Did not find SOCKS5 configuration file at", scfile, "; ignoring subsystem...")
}
dbusp, err = newDbusObjectPrompt()

@ -0,0 +1,5 @@
log_level="NOTICE"
log_redact=false
prompt_expanded=true
prompt_expert=true
default_action="SESSION"
Loading…
Cancel
Save