From be96920b5da071300e2aba22606607968a218259 Mon Sep 17 00:00:00 2001 From: K1ngst0m Date: Thu, 25 Jan 2024 00:20:58 +0800 Subject: [PATCH] configure.sh: Handle Podman Docker Wrapper. --- configure.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.sh b/configure.sh index 3b5f7a4a91..79ac65c271 100755 --- a/configure.sh +++ b/configure.sh @@ -56,11 +56,22 @@ check_container_engine() { fi touch permission_check - local inner_uid="$($1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \ + + # Capture both stdout and stderr + local output="$($1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \ --rm $2 \ stat --format "%u" /test/permission_check 2>&1)" rm permission_check + # Filter output to get inner_uid or "Permission denied" + local inner_uid=$(echo "$output" | grep -E '^[0-9]+|Permission denied') + + # Check if inner_uid is not captured or empty + if [ -z "$inner_uid" ]; then + err "Unable to determine UID - received output: $output" + die "Please check your $1 setup." + fi + if [[ $inner_uid == *"Permission denied"* ]]; then err "The container cannot access files. Are you using SELinux?" die "Please read README.md and check your $1 setup works."