Files
egg-avorion/entrypoint.sh
alexveley a7d78e8b19
Some checks failed
Build and Publish Docker Image / docker (push) Failing after 2m22s
Add Avorion Pterodactyl compatibility image
2026-04-25 00:39:42 -04:00

40 lines
888 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
export USER=container
export HOME=/home/container
mkdir -p /home/container /tmp
uid="$(id -u)"
gid="$(id -g)"
PASSWD_FILE="/tmp/passwd"
GROUP_FILE="/tmp/group"
cp /etc/passwd "$PASSWD_FILE"
cp /etc/group "$GROUP_FILE"
if ! getent passwd "$uid" >/dev/null 2>&1; then
echo "container:x:${uid}:${gid}::/home/container:/bin/bash" >> "$PASSWD_FILE"
fi
if ! getent group "$gid" >/dev/null 2>&1; then
echo "container:x:${gid}:" >> "$GROUP_FILE"
fi
export NSS_WRAPPER_PASSWD="$PASSWD_FILE"
export NSS_WRAPPER_GROUP="$GROUP_FILE"
libnss="$(find /usr/lib /lib -name 'libnss_wrapper.so' 2>/dev/null | head -n 1 || true)"
if [ -n "$libnss" ]; then
export LD_PRELOAD="${libnss}${LD_PRELOAD:+:${LD_PRELOAD}}"
fi
cd /home/container
if [ -n "${STARTUP:-}" ]; then
echo ":/home/container$ ${STARTUP}"
exec /bin/bash -c "${STARTUP}"
fi
exec "$@"