diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-06-05 17:14:08 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-06-05 17:22:34 -0300 |
commit | e1f3552c9c368661f9cc1c8be3ddef6017557402 (patch) | |
tree | a8b66398c4730380086732ff64ff75eca7f1a3e5 /src/leap/bitmask | |
parent | 0b8cd73171eee3bf3f3c7b91faa90104e85e492b (diff) |
Grep for gnome-shell as it were a polkit agent.
The $DESKTOP_SESSION is not reliable since is set to 'default' in any
case that you choose as your default desktop environment.
Also, after some tests, I've seen that the `gnome-shell` process is not
launched in the fallback mode, so we use it as a condition for the
polkit agent present.
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/services/eip/linuxvpnlauncher.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/leap/bitmask/services/eip/linuxvpnlauncher.py b/src/leap/bitmask/services/eip/linuxvpnlauncher.py index 54845a8a..955768d1 100644 --- a/src/leap/bitmask/services/eip/linuxvpnlauncher.py +++ b/src/leap/bitmask/services/eip/linuxvpnlauncher.py @@ -63,28 +63,21 @@ def _is_auth_agent_running(): :return: True if it's running, False if it's not. :rtype: boolean """ + # Note that gnome-shell does not uses a separate process for the + # polkit-agent, it uses a polkit-agent within its own process so we can't + # ps-grep a polkit process, we can ps-grep gnome-shell itself. + # the [x] thing is to avoid grep match itself polkit_options = [ 'ps aux | grep "polkit-[g]nome-authentication-agent-1"', 'ps aux | grep "polkit-[k]de-authentication-agent-1"', 'ps aux | grep "polkit-[m]ate-authentication-agent-1"', - 'ps aux | grep "[l]xpolkit"' + 'ps aux | grep "[l]xpolkit"', + 'ps aux | grep "[g]nome-shell"', ] is_running = [commands.getoutput(cmd) for cmd in polkit_options] - # gnome-shell does not uses a separate process for the polkit-agent, it - # uses a polkit-agent within its own process so we can't ps-grep it. - is_running = any(is_running) - if not is_running: - is_gnome_shell = commands.getoutput('ps aux | grep [g]nome-shell') - - # $DESKTOP_SESSION == 'gnome' -> gnome-shell - # $DESKTOP_SESSION == 'gnome-fallback' -> gnome-shell fallback mode, - # uses polkit-gnome... - if is_gnome_shell and os.getenv("DESKTOP_SESSION") == 'gnome': - is_running = True - - return is_running + return any(is_running) def _try_to_launch_agent(): |