summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpkg/build_bundle_with_venv.sh2
-rw-r--r--pkg/pyinst/build.mk7
-rw-r--r--src/leap/bitmask/gui/app.py4
-rw-r--r--src/leap/bitmask/vpn/_config.py12
-rw-r--r--src/leap/bitmask/vpn/privilege.py16
5 files changed, 37 insertions, 4 deletions
diff --git a/pkg/build_bundle_with_venv.sh b/pkg/build_bundle_with_venv.sh
index 1d615ce..450261a 100755
--- a/pkg/build_bundle_with_venv.sh
+++ b/pkg/build_bundle_with_venv.sh
@@ -44,4 +44,4 @@ $VIRTUAL_ENV/bin/pip install dist/*.whl
pip install pixelated-www pixelated-user-agent --find-links https://downloads.leap.se/libs/pixelated/
make bundle
-make bundle_gpg
+make bundle_apps
diff --git a/pkg/pyinst/build.mk b/pkg/pyinst/build.mk
index 554009d..760f798 100644
--- a/pkg/pyinst/build.mk
+++ b/pkg/pyinst/build.mk
@@ -26,6 +26,13 @@ bundle_gpg:
mkdir -p $(DIST_VERSION)/apps/mail
cp /usr/bin/gpg $(DIST_VERSION)/apps/mail/
+bundle_linux_helpers:
+ mkdir -p $(DIST_VERSION)/apps/helpers
+ cp src/leap/bitmask/vpn/helpers/linux/bitmask-root $(DIST_VERSION)/apps/helpers/
+ cp src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.bundle.policy $(DIST_VERSION)/apps/helpers/
+
+bundle_apps: bundle_gpg bundle_linux_helpers
+
bundle_tar:
cd dist/ && tar cvzf Bitmask.$(NEXT_VERSION).tar.gz bitmask-$(NEXT_VERSION)
diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py
index 42e1280..57bed56 100644
--- a/src/leap/bitmask/gui/app.py
+++ b/src/leap/bitmask/gui/app.py
@@ -244,6 +244,10 @@ def start_app():
# DEBUG ====================================
if STANDALONE and len(sys.argv) > MIN_ARGS:
+ if sys.argv[1] == 'bitmask_helpers':
+ from leap.bitmask.vpn.helpers import main
+ return main()
+
from leap.bitmask.cli import bitmask_cli
return bitmask_cli.main()
diff --git a/src/leap/bitmask/vpn/_config.py b/src/leap/bitmask/vpn/_config.py
index 5f10734..421d15a 100644
--- a/src/leap/bitmask/vpn/_config.py
+++ b/src/leap/bitmask/vpn/_config.py
@@ -1,14 +1,24 @@
+import os.path
import pkg_resources
-from .constants import IS_LINUX
+from .constants import IS_LINUX
+from leap.bitmask.util import STANDALONE, here
if IS_LINUX:
def get_bitmask_helper_path():
+ if STANDALONE:
+ return os.path.join(here(), "..", "apps", "helpers",
+ "bitmask-root")
+
return pkg_resources.resource_filename(
'leap.bitmask.vpn.helpers.linux', 'bitmask-root')
def get_bitmask_polkit_policy_path():
+ if STANDALONE:
+ return os.path.join(here(), "..", "apps", "helpers",
+ "se.leap.bitmask.bundle.policy")
+
return pkg_resources.resource_filename(
'leap.bitmask.vpn.helpers.linux', 'se.leap.bitmask.bundle.policy')
diff --git a/src/leap/bitmask/vpn/privilege.py b/src/leap/bitmask/vpn/privilege.py
index 9666a94..ef33337 100644
--- a/src/leap/bitmask/vpn/privilege.py
+++ b/src/leap/bitmask/vpn/privilege.py
@@ -31,6 +31,8 @@ from abc import ABCMeta, abstractmethod
from twisted.logger import Logger
from twisted.python.procutils import which
+from leap.bitmask.util import STANDALONE, here
+
log = Logger()
@@ -38,15 +40,25 @@ flags_STANDALONE = False
def install_helpers():
+ cmd = 'bitmask_helpers install'
+ if STANDALONE:
+ binary_path = os.path.join(here(), "bitmask")
+ cmd = "%s %s" % (binary_path, cmd)
+
# TODO check if the command has succeeded, and display error
# if failed
- commands.getoutput('pkexec bitmask_helpers install')
+ commands.getoutput('pkexec ' + cmd)
def uninstall_helpers():
+ cmd = 'bitmask_helpers uninstall'
+ if STANDALONE:
+ binary_path = os.path.join(here(), "bitmask")
+ cmd = "%s %s" % (binary_path, cmd)
+
# TODO check if the command has succeeded, and display error
# if failed
- commands.getoutput('pkexec bitmask_helpers uninstall')
+ commands.getoutput('pkexec ' + cmd)
class NoPolkitAuthAgentAvailable(Exception):