Moved dmidecode script from Dockerfile to own file

This commit is contained in:
NATroutter
2026-01-22 20:06:13 +02:00
parent c53ed4f620
commit e9eb3ea78a
3 changed files with 31 additions and 1 deletions

View File

@@ -50,7 +50,8 @@ COPY --chmod=755 ./lib /egg-hytale/lib
RUN sed -i 's/\r$//' /egg-hytale/lib/*.sh
# Create dmidecode shim for Docker usage
RUN echo "Creating local dmidecode for Docker usage." && printf '#!/bin/sh\nif [ "$1" = "-s" ] && [ "$2" = "system-uuid" ]; then\n UUID_FILE="$HOME/.hytale_system_uuid"\n\n if [ -f "$UUID_FILE" ]; then\n cat "$UUID_FILE"\n else\n if command -v uuidgen >/dev/null 2>&1; then\n uuidgen | tr "A-Z" "a-z" | tee "$UUID_FILE" >/dev/null\n else\n cat /proc/sys/kernel/random/uuid | tee "$UUID_FILE" >/dev/null\n fi\n cat "$UUID_FILE"\n fi\n\n printf "\\n"\n exit 0\nfi\n\necho "dmidecode shim: unsupported args: $*" >&2\nexit 1\n' > /usr/local/bin/dmidecode && chmod +x /usr/local/bin/dmidecode
COPY --chmod=755 ./lib/dmidecode /usr/local/bin/dmidecode
RUN sed -i 's/\r$//' /usr/local/bin/dmidecode
RUN sed -i 's/\r$//' /entrypoint.sh

View File

@@ -59,6 +59,11 @@ if [ -n "$OVERRIDE_SESSION_TOKEN" ] && [ -n "$OVERRIDE_IDENTITY_TOKEN" ]; then
SESSION_TOKEN="$OVERRIDE_SESSION_TOKEN"
IDENTITY_TOKEN="$OVERRIDE_IDENTITY_TOKEN"
else
# Default to persistent authentication if not specified, this is needed for backwards combability
if [ -z "$USE_PERSISTENT_AUTHENTICATION" ]; then
USE_PERSISTENT_AUTHENTICATION="ENABLED"
fi
if [ "$USE_PERSISTENT_AUTHENTICATION" = "ENABLED" ]; then
# Standard mode: perform authentication
if check_cached_tokens && load_cached_tokens; then

24
lib/dmidecode Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
echo "Creating local dmidecode for Docker usage."
if [ "$1" = "-s" ] && [ "$2" = "system-uuid" ]; then
UUID_FILE="$HOME/.hytale_system_uuid"
if [ -f "$UUID_FILE" ]; then
cat "$UUID_FILE"
else
if command -v uuidgen >/dev/null 2>&1; then
uuidgen | tr "A-Z" "a-z" | tee "$UUID_FILE" >/dev/null
else
cat /proc/sys/kernel/random/uuid | tee "$UUID_FILE" >/dev/null
fi
cat "$UUID_FILE"
fi
printf "\n"
exit 0
fi
echo "dmidecode shim: unsupported args: $*" >&2
exit 1