diff --git a/entrypoint.sh b/entrypoint.sh index e187670..a85a1d3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,4 +44,12 @@ mc cp -r s3/$remote_path $local_path ok_or_die "Could not fetch object" # Fix owner of local path -chown -R "${ACTION_UID:-root}:${ACTION_GID:-root}" $local_path +if [ -n "${ACTION_UID}" ] && [ -n "${ACTION_GID}" ]; then + LOCAL_UID="${ACTION_UID}" + LOCAL_GID="${ACTION_GID}" +else + LOCAL_UID="$(stat -c %u .)" + LOCAL_GID="$(stat -c %g .)" +fi +info "Setting owner/group of $local_path to ${LOCAL_UID:-root}:${LOCAL_GID:-root}" +chown -R "${LOCAL_UID:-root}:${LOCAL_GID:-root}" $local_path