2024-01-04 22:33:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
source /docker/helpers.sh
|
|
|
|
|
2024-01-05 00:11:20 +00:00
|
|
|
entrypoint-set-script-name "$0"
|
2024-01-04 22:33:41 +00:00
|
|
|
|
|
|
|
# Optionally fix ownership of configured paths
|
|
|
|
: ${ENTRYPOINT_ENSURE_OWNERSHIP_PATHS:=""}
|
|
|
|
|
|
|
|
declare -a ensure_ownership_paths=()
|
2024-01-04 23:04:25 +00:00
|
|
|
IFS=' ' read -a ensure_ownership_paths <<<"${ENTRYPOINT_ENSURE_OWNERSHIP_PATHS}"
|
2024-01-04 22:33:41 +00:00
|
|
|
|
2024-01-04 23:04:25 +00:00
|
|
|
if [[ ${#ensure_ownership_paths[@]} == 0 ]]; then
|
2024-01-04 22:33:41 +00:00
|
|
|
log-info "No paths has been configured for ownership fixes via [\$ENTRYPOINT_ENSURE_OWNERSHIP_PATHS]."
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for path in "${ensure_ownership_paths[@]}"; do
|
2024-01-04 23:04:25 +00:00
|
|
|
log-info "Ensure ownership of [${path}] is correct"
|
|
|
|
run-as-current-user chown --recursive ${RUNTIME_UID}:${RUNTIME_GID} "${path}"
|
2024-01-04 22:33:41 +00:00
|
|
|
done
|