Skip to content

Commit 96cb1af

Browse files
author
Marius Benthin
committed
fix: abort if download of THOR binaries failed
1 parent a6962b8 commit 96cb1af

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services:
4747
# Optional: mount TLS certificate and private key (uncomment TLS_CERT/TLS_KEY above as well)
4848
# - ./tls_cert:/run/secrets/tls_cert:ro
4949
# - ./tls_key:/run/secrets/tls_key:ro
50-
restart: unless-stopped
50+
restart: on-failure
5151
# THOR 10: periodically restart the container by signaling PID 1 once uptime exceeds
5252
# SIGNATURE_UPDATE_INTERVAL hours; restart policy brings it back up. Skipped when
5353
# SIGNATURE_UPDATE_INTERVAL is 0 (disabled, default) or TECHPREVIEW is set (THOR 11

entrypoint.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@
44
if [ ! -f "$TARGET_DIR/thor-util" ]; then
55
if [ -z "$CONTRACT_TOKEN" ]; then
66
echo "CONTRACT_TOKEN is required to download THOR!" >&2
7-
exit 1
7+
exit 0
88
fi
99
echo "Downloading THOR..." && \
10-
wget -q -O "$TEMP_DIR/thor.zip" "https://portal.nextron-systems.com/api/voucher/download/$CONTRACT_TOKEN/thor/linux" && \
10+
wget -O "$TEMP_DIR/thor.zip" "https://portal.nextron-systems.com/api/voucher/download/$CONTRACT_TOKEN/thor/linux" && \
1111
unzip -o -q "$TEMP_DIR/thor.zip" -d "$TARGET_DIR" && \
1212
rm "$TEMP_DIR/thor.zip"
1313
fi
1414

15+
# abort if THOR binary is not available
16+
if [ ! -f "$TARGET_DIR/thor-linux-64" ]; then
17+
echo "THOR binary not found at $TARGET_DIR/thor-linux-64. Abort!"
18+
echo "Please verify that your CONTRACT_TOKEN is set and valid."
19+
exit 0
20+
fi
21+
1522
# detect THOR channel using the "-dev" pre-release suffix in the manifest
1623
# TODO: has to be adjusted once THOR 11 is in techpreview but does not carry the -dev suffix anymore
1724
THOR_CHANNEL=stable
@@ -30,7 +37,7 @@ fi
3037
THOR_VERSION=$("$TARGET_DIR/thor-linux-64" --version 2>&1 | awk '/^THOR / { split($2, v, "."); print v[1]; exit }')
3138
if [ -z "$THOR_VERSION" ]; then
3239
echo "Failed to detect THOR major version from $TARGET_DIR/thor-linux-64 --version" >&2
33-
exit 1
40+
exit 0
3441
fi
3542
echo "Detected THOR major version: $THOR_VERSION"
3643

0 commit comments

Comments
 (0)