From 5103c1c46dadb15af0327c8069d4c321f4f93d4f Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Wed, 1 Feb 2017 18:35:15 +0100 Subject: [feature] add install/uninstall command for helpers --- src/leap/bitmask/vpn/helpers/__init__.py | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/leap/bitmask/vpn/helpers/__init__.py (limited to 'src/leap/bitmask/vpn/helpers/__init__.py') diff --git a/src/leap/bitmask/vpn/helpers/__init__.py b/src/leap/bitmask/vpn/helpers/__init__.py new file mode 100644 index 00000000..1f46fd79 --- /dev/null +++ b/src/leap/bitmask/vpn/helpers/__init__.py @@ -0,0 +1,35 @@ +from os import remove +from shutil import copyfile +import sys + +from leap.bitmask.vpn.constants import IS_LINUX +from leap.bitmask.vpn import _config + +if IS_LINUX: + + helper_to = '/usr/local/sbin/bitmask-root' + polkit_to = '/usr/share/polkit-1/actions/se.bitmask.bundle.policy' + + def install(): + helper_from = _config.get_bitmask_helper_path() + polkit_from = _config.get_bitmask_polkit_policy_path() + copyfile(helper_from, helper_to) + copyfile(polkit_from, polkit_to) + + def uninstall(): + try: + remove(helper_to) + remove(polkit_to) + except: + raise + + +def main(): + if sys.argv[-1] == 'install': + install() + if sys.argv[-1] == 'uninstall': + uninstall() + + +if __name__ == "__main__": + main() -- cgit v1.2.3