From 058329272829c147afcd1ae01f4ee4dc8867d110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Petter=20Ska=CC=8Alerud?= Date: Thu, 5 Jun 2025 10:18:56 +0200 Subject: [PATCH] Coin, FFmpeg: Check for valid envvars in install-ffmpeg-android.sh This script requires that we have setup specific environment variables ahead of time. If they are missing, we are prone to receiving non-descriptive error messages. This patch adds checks for the required environment variables, and gives useful error messages if they are not set correctly. Pick-to: 6.10 6.9 6.8 Change-Id: I0cfb99187f303b22dbdd46a7a848b85dbf571aad Reviewed-by: Assam Boudjelthia --- .../common/unix/install-ffmpeg-android.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/coin/provisioning/common/unix/install-ffmpeg-android.sh b/coin/provisioning/common/unix/install-ffmpeg-android.sh index 8a855d31..62ee173f 100755 --- a/coin/provisioning/common/unix/install-ffmpeg-android.sh +++ b/coin/provisioning/common/unix/install-ffmpeg-android.sh @@ -13,6 +13,17 @@ target_install_dir_param="$2" build_type=$(get_ffmpeg_build_type) ffmpeg_source_dir=$(download_ffmpeg) +assert_envvar_is_populated_dir() { + local envvar="$1" + local value="${!envvar}" + if [ -z "$value" ] || [ ! -d "$value" ] || [ -z "$(find "$value" -mindepth 1 -type f | head -n 1)" ]; then + echo "Environment variable '$envvar' is unset, not a directory, or the directory is empty." + exit 1 + fi +} +assert_envvar_is_populated_dir "OPENSSL_ANDROID_HOME_DEFAULT" +assert_envvar_is_populated_dir "ANDROID_NDK_ROOT_DEFAULT" + build_ffmpeg_android() { local target_arch=$1 local target_dir=$2