summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/main.go b/main.go
index 08d1579..82a3a9e 100644
--- a/main.go
+++ b/main.go
@@ -31,7 +31,7 @@ func main() {
log.Fatal(err)
}
- go notificate(conf)
+ notify := newNotificator(conf)
b, err := bitmask.Init()
if err != nil {
@@ -39,5 +39,23 @@ func main() {
}
defer b.Close()
+ checkAndInstallHelpers(b, notify)
run(b, conf)
}
+
+func checkAndInstallHelpers(b *bitmask.Bitmask, notify *notificator) {
+ helpers, priviledge, err := b.VPNCheck()
+ if err.Error() == "nopolkit" || (err == nil && !priviledge) {
+ log.Printf("No polkit found")
+ notify.authAgent()
+ } else if err != nil {
+ log.Fatal(err)
+ }
+
+ if !helpers {
+ err = b.InstallHelpers()
+ if err != nil {
+ log.Println("Error installing helpers: ", err)
+ }
+ }
+}