From ed227892246e52e07ca6805a061565025ecf0bfe Mon Sep 17 00:00:00 2001 From: "Diaz de Grenu, Jose" Date: Wed, 9 Nov 2016 16:59:44 +0100 Subject: [PATCH] trustfence: make sign script threadsafe Ensure that the signing script is not executed in parallel. This is required in order to avoid problems during PKI generation and CST usage when building with Yocto or the Android build system. https://jira.digi.com/browse/DEL-2849 Signed-off-by: Diaz de Grenu, Jose --- .../trustfence-sign-tools/trustfence-sign-kernel.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-kernel.sh b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-kernel.sh index 2c51850ec..26ae7ea89 100755 --- a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-kernel.sh +++ b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-kernel.sh @@ -22,6 +22,13 @@ # #=============================================================================== +# Avoid parallel execution of this script +SINGLE_PROCESS_LOCK="/tmp/sign_script.lock.d" +trap 'rm -rf "${SINGLE_PROCESS_LOCK}"' INT TERM EXIT +while ! mkdir "${SINGLE_PROCESS_LOCK}" > /dev/null 2>&1; do + sleep 1 +done + SCRIPT_NAME="$(basename ${0})" SCRIPT_PATH="$(cd $(dirname ${0}) && pwd)"