From 89d126e96b1ed3ac1076b3c45129f8bc78a09700 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 17 Jun 2014 11:25:11 -0500 Subject: use bash installer instead of the temporal script --- pkg/linux/README.rst | 7 ++++++- pkg/linux/leap-install-helper.sh | 3 ++- src/leap/bitmask/platform_init/initializers.py | 28 ++++++++------------------ 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/pkg/linux/README.rst b/pkg/linux/README.rst index 249c721f..f89842d3 100644 --- a/pkg/linux/README.rst +++ b/pkg/linux/README.rst @@ -15,10 +15,15 @@ path will be used if the flag ``--standalone`` is set:: bitmask-root -> /usr/local/sbin/bitmask-root polkit/se.leap.bitmask.bundle.policy -> /usr/share/polkit-1/actions/se.leap.bitmask.bundle.policy -You will also have to place an openvpn binary in the following path:: +When running with ``--standalone`` flag, the openvpn binary is expected in the following path:: leap-openvpn -> /usr/local/sbin/leap-openvpn +The bundle will use the script ``leap-install-helper.sh`` to copy the needed +files. If you ever want to use it manually to update the helpers or bins, it +needs a ``--from-path`` parameter to be passed to it. This points to a folder +from where all the needed binaries and scripts can be found. + Binary hashing ============== diff --git a/pkg/linux/leap-install-helper.sh b/pkg/linux/leap-install-helper.sh index bed48255..566dd3d9 100755 --- a/pkg/linux/leap-install-helper.sh +++ b/pkg/linux/leap-install-helper.sh @@ -19,8 +19,9 @@ LOCAL_SBIN_FOLDER=/usr/local/sbin +POLKIT_FOLDER="/usr/share/polkit-1/actions" POLKIT_FILE="se.leap.bitmask.bundle.policy" -POLKIT_PATH="/usr/share/polkit-1/actions" +POLKIT_PATH="${POLKIT_FOLDER}/${POLKIT_FILE}" BITMASK_ROOT_FILE="bitmask-root" BITMASK_ROOT_PATH="${LOCAL_SBIN_FOLDER}/${BITMASK_ROOT_FILE}" diff --git a/src/leap/bitmask/platform_init/initializers.py b/src/leap/bitmask/platform_init/initializers.py index 859e7fe6..b7946c4c 100644 --- a/src/leap/bitmask/platform_init/initializers.py +++ b/src/leap/bitmask/platform_init/initializers.py @@ -401,39 +401,27 @@ def _linux_install_missing_scripts(badexec, notfound): os.path.join(os.getcwd(), "apps", "eip", "files")) launcher = LinuxVPNLauncher - # XXX refactor with darwin, same block. + install_helper = "linux-install-helper.sh" + install_helper_path = os.path.join(installer_path, install_helper) - if os.path.isdir(installer_path): + install_opts = ("--from-path %s --install-bitmask-root YES" + "--install-polkit-file YES --install-openvpn YES" % ( + installer_path,)) - # FIXME --------- call installer script --- - fd, tempscript = tempfile.mkstemp(prefix="leap_installer-") - polfd, pol_tempfile = tempfile.mkstemp(prefix="leap_installer-") + if os.path.isdir(installer_path): try: pkexec = first(launcher.maybe_pkexec()) - - scriptlines = launcher.cmd_for_missing_scripts(installer_path) - with os.fdopen(fd, 'w') as f: - f.write(scriptlines) - - st = os.stat(tempscript) - os.chmod(tempscript, st.st_mode | stat.S_IEXEC | stat.S_IXUSR | - stat.S_IXGRP | stat.S_IXOTH) - cmdline = ["%s %s" % (pkexec, tempscript)] + cmdline = ["%s %s" % (pkexec, install_helper_path, install_opts)] ret = subprocess.call( cmdline, stdout=subprocess.PIPE, shell=True) success = ret == 0 if not success: - logger.error("Install missing scripts failed.") + logger.error("Install of helpers failed.") except Exception as exc: logger.error(badexec) logger.error("Error was: %r" % (exc,)) - finally: - try: - os.remove(tempscript) - except OSError as exc: - logger.error("%r" % (exc,)) else: logger.error(notfound) logger.debug('path searched: %s' % (installer_path,)) -- cgit v1.2.3