diff options
| author | Leah Rowe <leah@libreboot.org> | 2025-05-17 16:51:12 +0100 | 
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2025-05-17 16:51:12 +0100 | 
| commit | 01a0217c1e39ef8f665b5499e210fac7d0221416 (patch) | |
| tree | 68bce94180bc70eff26a9fd32e182854e7ddf12e /include/get.sh | |
| parent | 4ca57943d7031c4a38d9dbd565fd58adf2a7c2c2 (diff) | |
get.sh: simplify bad_checksum()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/get.sh')
| -rw-r--r-- | include/get.sh | 12 | 
1 files changed, 4 insertions, 8 deletions
| diff --git a/include/get.sh b/include/get.sh index 244eb1bb..b83449b7 100644 --- a/include/get.sh +++ b/include/get.sh @@ -148,14 +148,10 @@ try_git()  bad_checksum()  { -	[ ! -f "$2" ] && printf "File '%s' missing (sha512sum '%s')\n" \ -	    "$2" "$1" 1>&2 && return 0 -	fchksum="$(x_ sha512sum "$2" | awk '{print $1}')" || \ -	    err "Can't get sha512sum on '$2' (checking for sha512sum '$1')" -	[ "$fchksum" != "$1" ] || return 1 -	printf "WARNING: BAD checksum for '%s' - expected '%s', got '%s'\n" \ -	    "$2" "$1" "$fchksum" 1>&2 -	x_ rm -f "$2" +	[ ! -f "$2" ] && printf "'%s' missing, %s\n" "$2" "$1" 1>&2 && return 0 +	csum="$(x_ sha512sum "$2" | awk '{print $1}')" || err "!sha512 '$2' $1" +	[ "$csum" != "$1" ] && printf "BAD SHA512, '%s'; need '%s', got %s\n" \ +	    "$2" "$1" "$csum" 1>&2 && x_ rm -f "$2" && return 0; return 1  }  tmpclone() | 
