diff options
author | Kali Kaneko <kali@leap.se> | 2015-11-02 18:31:44 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-11-02 18:50:32 -0400 |
commit | 09728aabff26c0f86af259618632c67a9ee4dfef (patch) | |
tree | 88336dee7374ede7a0b2b46caa45fa4140a54dc7 /src/leap/bitmask/services/soledad/soledadbootstrapper.py | |
parent | 57690debdceb2e644dbbc3a3127c0711f741587f (diff) |
[cherry-pick] [bug] use gpg2 binary if gpg not found. Closes: #7563
from debian stretch on, gpg will be a symlink to gpg2.
this is currently failing if one uses dpkg-divert to make gpg2 provide
/usr/bin/gpg.
this solution just attempts to use gpg2 binary if the search for gpg
binary fails.
- Resolves: #7563
- Releases: 0.9.1
Diffstat (limited to 'src/leap/bitmask/services/soledad/soledadbootstrapper.py')
-rw-r--r-- | src/leap/bitmask/services/soledad/soledadbootstrapper.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/leap/bitmask/services/soledad/soledadbootstrapper.py b/src/leap/bitmask/services/soledad/soledadbootstrapper.py index f3d50925..7030f419 100644 --- a/src/leap/bitmask/services/soledad/soledadbootstrapper.py +++ b/src/leap/bitmask/services/soledad/soledadbootstrapper.py @@ -444,7 +444,20 @@ class SoledadBootstrapper(AbstractBootstrapper): if IS_MAC: gpgbin = os.path.abspath( os.path.join(here(), "apps", "mail", "gpg")) - leap_check(gpgbin is not None, "Could not find gpg binary") + if gpgbin is None: + try: + gpgbin_options = which("gpg2") + # gnupg checks that the path to the binary is not a + # symlink, so we need to filter those and come up with + # just one option. + for opt in gpgbin_options: + if not os.path.islink(opt): + gpgbin = opt + break + except IndexError as e: + logger.debug("Couldn't find the gpg2 binary!") + logger.exception(e) + leap_check(gpgbin is not None, "Could not find gpg2 binary") return gpgbin def _init_keymanager(self, address, token): |