Update install-docker-agent.sh to handle log_error and calculated checksum containing linebreak

Added missing function log_error
Updated checksum check to handle \r at the end of calculated_checksum
This commit is contained in:
olagrasli 2025-11-24 21:09:44 +01:00 committed by GitHub
parent 30d2d4ecd3
commit a3c36921e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,6 +38,10 @@ log_warn() {
printf '[WARN] %s\n' "$1" >&2
}
log_error() {
printf '[ERROR] %s\n' "$1" >&2
}
log_header() {
printf '\n== %s ==\n' "$1"
}
@ -1715,7 +1719,7 @@ verify_agent_checksum() {
return 0
fi
if [[ "$FETCHED_CHECKSUM" != "$CALCULATED_CHECKSUM" ]]; then
if [[ "$(echo "$FETCHED_CHECKSUM" | tr -d '\r\n')" != "$(echo "$CALCULATED_CHECKSUM" | tr -d '\r\n')" ]]; then
rm -f "$AGENT_PATH"
log_error "Checksum mismatch. Expected $FETCHED_CHECKSUM but downloaded $CALCULATED_CHECKSUM"
return 1