Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure.sh: Handle Podman Docker Wrapper #7439

Open
wants to merge 2 commits into
base: proton_8.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,36 @@ check_container_engine() {
fi

touch permission_check
local inner_uid="$($1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \
--rm $2 \
stat --format "%u" /test/permission_check 2>&1)"

# Create a temporary file for capturing output
local temp_output_file=$(mktemp)

# Execute the check command and redirect to the temporary file
$1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \
--rm $2 stat --format "%u" /test/permission_check \
>"$temp_output_file" 2>&1
local return_code=$?

local output=$(<"$temp_output_file")

rm "$temp_output_file"

if [ $return_code -ne 0 ]; then
err "Command failed with return code $return_code. Output: $output"
die "Please check your $1 setup."
fi

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