From ecb14840869f6af59ec03fab795bae94c407328f Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Sun, 23 Feb 2020 13:03:59 +0100 Subject: sign-build.sh: fix unexpected operator with multiple TARGET_FILES sign-build sometimes fails when there is multiple files matching the *-target_files-*.zip pattern for TARGET_FILES: when checking if TARGET_FILES is a file with [ -f $TARGET_FILES ], it can fail because -f expects ai single path. When it happens the failure looks like that: vendor/replicant/sign-build: 111: [: [...]/out/target/product/maguro/obj/PACKAGING/target_files_intermediates/replicant_maguro-target_files-3c9b1e0289.zip: unexpected operator The TARGET_FILES files we are sigining in sign-build.sh have their build rules in build/core/Makefile where the resulting path of the file is defined in this way: BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip name is in turn defined like this: name := $(name)-target_files-$(FILE_NAME_TAG) and FILE_NAME_TAG like this: FILE_NAME_TAG := $(BUILD_NUMBER) Since we have access to the device name and the BUILD_NUMBER that is used to construct the FILE_NAME_TAG, we can use them to find out the name of the file to sign instead of relying on fragile glob ('*') patterns. Signed-off-by: Denis 'GNUtoo' Carikli --- sign-build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sign-build b/sign-build index 11bf8bea..304c8809 100755 --- a/sign-build +++ b/sign-build @@ -40,7 +40,8 @@ else fi TARGET_DIR=$OUT_DIR/target/product/$DEVICE -TARGET_FILES=$TARGET_DIR/obj/PACKAGING/target_files_intermediates/*-target_files-*.zip +TARGET_FILES=$TARGET_DIR/obj/PACKAGING/target_files_intermediates/replicant_${DEVICE}-target_files-${BUILD_NUMBER}.zip + DIST_OUT_DIR=$OUT_DIR/"dist"/$DEVICE RELEASE=replicant-6.0-dev -- cgit v1.2.3