diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-15 17:30:38 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-15 17:30:38 +0200 |
commit | e563799518d4c9ec8e93a2dc862214ffd7a216f7 (patch) | |
tree | 44294198ad6266c23cd3b17297a4a6a5278ace91 | |
parent | ba774b1654efcd7b27f84c3e0f6fd9d98bc0f0d0 (diff) | |
download | kube-e563799518d4c9ec8e93a2dc862214ffd7a216f7.tar.gz kube-e563799518d4c9ec8e93a2dc862214ffd7a216f7.zip |
A faster and working gpg-agent wrapper
-rw-r--r-- | cmake/modules/generate_crypto_test_wrapper.cmake | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/cmake/modules/generate_crypto_test_wrapper.cmake b/cmake/modules/generate_crypto_test_wrapper.cmake index 836662c3..1d145fd6 100644 --- a/cmake/modules/generate_crypto_test_wrapper.cmake +++ b/cmake/modules/generate_crypto_test_wrapper.cmake | |||
@@ -1,5 +1,6 @@ | |||
1 | # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> | 1 | # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> |
2 | # Copyright (c) 2013, Sandro Knauß <mail@sandroknauss.de> | 2 | # Copyright (c) 2013, Sandro Knauß <mail@sandroknauss.de> |
3 | # Copyright (c) 2018, Christian Mollekopf <mollekopf@kolabsys.com> | ||
3 | # | 4 | # |
4 | # Redistribution and use is allowed according to the terms of the BSD license. | 5 | # Redistribution and use is allowed according to the terms of the BSD license. |
5 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | 6 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
@@ -8,7 +9,7 @@ | |||
8 | if (UNIX) | 9 | if (UNIX) |
9 | 10 | ||
10 | file(WRITE "${_filename}" | 11 | file(WRITE "${_filename}" |
11 | "#!/bin/sh | 12 | "#!/usr/bin/env sh |
12 | # created by cmake, don't edit, changes will be lost | 13 | # created by cmake, don't edit, changes will be lost |
13 | 14 | ||
14 | # don't mess with a gpg-agent already running on the system | 15 | # don't mess with a gpg-agent already running on the system |
@@ -16,18 +17,7 @@ unset GPG_AGENT_INFO | |||
16 | 17 | ||
17 | ${_library_path_variable}=${_ld_library_path}\${${_library_path_variable}:+:\$${_library_path_variable}} GNUPGHOME=${_gnupghome} gpg-agent --daemon \"${_executable}\" \"$@\" | 18 | ${_library_path_variable}=${_ld_library_path}\${${_library_path_variable}:+:\$${_library_path_variable}} GNUPGHOME=${_gnupghome} gpg-agent --daemon \"${_executable}\" \"$@\" |
18 | _result=$? | 19 | _result=$? |
19 | _pid=`echo GETINFO pid | GNUPGHOME=${_gnupghome} gpg-connect-agent | grep 'D' | cut -d' ' -f2` | 20 | GNUPGHOME=${_gnupghome} gpg-connect-agent killagent /bye |
20 | if [ ! -z \"\$_pid\" ]; then | ||
21 | echo \"Waiting for gpg-agent to terminate (PID: $_pid)...\" | ||
22 | while kill -0 \"\$_pid\"; do | ||
23 | sleep 1 | ||
24 | output=`ps -p \"\$_pid\" | grep \"gpg-agent\" | grep \"defunc\"` | ||
25 | if [ ! -z \"\$output\" ]; then | ||
26 | echo \"Process is defunc, moving on\" | ||
27 | break | ||
28 | fi | ||
29 | done | ||
30 | fi | ||
31 | exit \$_result | 21 | exit \$_result |
32 | ") | 22 | ") |
33 | 23 | ||