mirror of
https://github.com/hanzo-ml/spark-operator.git
synced 2026-10-30 20:39:07 +00:00
* ci: add shfmt and shellcheck checks for shell scripts Signed-off-by: tariq-hasan <[email protected]> * fix: address PR review feedback on shell lint setup Signed-off-by: tariq-hasan <[email protected]> --------- Signed-off-by: tariq-hasan <[email protected]>
32 lines
1.2 KiB
Bash
Executable File
32 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# echo commands to the terminal output
|
|
set -ex
|
|
|
|
# Check whether there is a passwd entry for the container UID
|
|
myuid="$(id -u)"
|
|
# If there is no passwd entry for the container UID, attempt to fake one
|
|
# You can also refer to the https://github.com/docker-library/official-images/pull/13089#issuecomment-1534706523
|
|
# It's to resolve OpenShift random UID case.
|
|
# See also: https://github.com/docker-library/postgres/pull/448
|
|
if ! getent passwd "$myuid" &> /dev/null; then
|
|
for wrapper in {/usr,}/lib{/*,}/libnss_wrapper.so; do
|
|
if [ -s "$wrapper" ]; then
|
|
NSS_WRAPPER_PASSWD="$(mktemp)"
|
|
NSS_WRAPPER_GROUP="$(mktemp)"
|
|
export LD_PRELOAD="$wrapper" NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
|
|
mygid="$(id -g)"
|
|
printf 'spark:x:%s:%s:%s:%s:/bin/false\n' "$myuid" "$mygid" "${SPARK_USER_NAME:-anonymous uid}" "$SPARK_HOME" > "$NSS_WRAPPER_PASSWD"
|
|
printf 'spark:x:%s:\n' "$mygid" > "$NSS_WRAPPER_GROUP"
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Path for catatonit may differ depending on base container OS
|
|
CATATONIT=$(command -v catatonit) || {
|
|
echo "error: catatonit not found in PATH" >&2
|
|
exit 1
|
|
}
|
|
exec "$CATATONIT" -- /usr/bin/spark-operator "$@"
|