From 9961cccc89c48f9ce653c75fabbfc829900b82fe Mon Sep 17 00:00:00 2001
From: "Kali Kaneko (leap communications)" <kali@leap.se>
Date: Thu, 6 Sep 2018 15:48:34 +0200
Subject: [PATCH] [bug] pass bitmask root path from snap

---
 standalone/launcher_linux.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/standalone/launcher_linux.go b/standalone/launcher_linux.go
index 4046fa52..a434ecd4 100644
--- a/standalone/launcher_linux.go
+++ b/standalone/launcher_linux.go
@@ -31,7 +31,6 @@ const (
 var bitmaskRootPaths = []string{
 	"/usr/sbin/bitmask-root",
 	"/usr/local/sbin/bitmask-root",
-	"/snap/bin/riseup-vpn.bitmask-root",
 }
 
 type launcher struct {
@@ -113,6 +112,12 @@ func runBitmaskRoot(arg ...string) error {
 }
 
 func bitmaskRootPath() (string, error) {
+	if os.Getenv("SNAP") != "" {
+		path := "/snap/bin/riseup-vpn.bitmask-root"
+		if _, err := os.Stat(path); !os.IsNotExist(err) {
+			return path, nil
+		}
+	}
 	for _, path := range bitmaskRootPaths {
 		if _, err := os.Stat(path); !os.IsNotExist(err) {
 			return path, nil
-- 
GitLab