Skip to content

Commit

Permalink
configure.sh: Handle Podman Docker Wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
K1ngst0m committed Jan 24, 2024
1 parent 761c978 commit c197248
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit c197248

Please sign in to comment.