Skip to content

Commit e9eb3ea

Browse files
committed
Moved dmidecode script from Dockerfile to own file
1 parent c53ed4f commit e9eb3ea

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ COPY --chmod=755 ./lib /egg-hytale/lib
5050
RUN sed -i 's/\r$//' /egg-hytale/lib/*.sh
5151

5252
# Create dmidecode shim for Docker usage
53-
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
53+
COPY --chmod=755 ./lib/dmidecode /usr/local/bin/dmidecode
54+
RUN sed -i 's/\r$//' /usr/local/bin/dmidecode
5455

5556
RUN sed -i 's/\r$//' /entrypoint.sh
5657

entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ if [ -n "$OVERRIDE_SESSION_TOKEN" ] && [ -n "$OVERRIDE_IDENTITY_TOKEN" ]; then
5959
SESSION_TOKEN="$OVERRIDE_SESSION_TOKEN"
6060
IDENTITY_TOKEN="$OVERRIDE_IDENTITY_TOKEN"
6161
else
62+
# Default to persistent authentication if not specified, this is needed for backwards combability
63+
if [ -z "$USE_PERSISTENT_AUTHENTICATION" ]; then
64+
USE_PERSISTENT_AUTHENTICATION="ENABLED"
65+
fi
66+
6267
if [ "$USE_PERSISTENT_AUTHENTICATION" = "ENABLED" ]; then
6368
# Standard mode: perform authentication
6469
if check_cached_tokens && load_cached_tokens; then

lib/dmidecode

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
3+
#!/bin/sh
4+
echo "Creating local dmidecode for Docker usage."
5+
if [ "$1" = "-s" ] && [ "$2" = "system-uuid" ]; then
6+
UUID_FILE="$HOME/.hytale_system_uuid"
7+
8+
if [ -f "$UUID_FILE" ]; then
9+
cat "$UUID_FILE"
10+
else
11+
if command -v uuidgen >/dev/null 2>&1; then
12+
uuidgen | tr "A-Z" "a-z" | tee "$UUID_FILE" >/dev/null
13+
else
14+
cat /proc/sys/kernel/random/uuid | tee "$UUID_FILE" >/dev/null
15+
fi
16+
cat "$UUID_FILE"
17+
fi
18+
19+
printf "\n"
20+
exit 0
21+
fi
22+
23+
echo "dmidecode shim: unsupported args: $*" >&2
24+
exit 1

0 commit comments

Comments
 (0)