Prevent numerical comparison for decimal-looking sha256sum output.
awk's double has a 53-bit mantissa, so largest integer it can hold
is exactly 2^53 or 9,007,199,254,740,992. The next integer is not
representable, and awk rounds it back. This means large numbers when
compared can lead to false equivalence.
For example:
a=1234567890123456789012345678901234567890123456789012345678901234
b=1234567890123456789012345678901234567890123456789012345678901235
a == b # true but should be false
Casting the sha256sum to a string fixes comparison. h/t kfv
While here ... (for script hardening):
CK and dist should be double-quoted.
While here ... (for readability and maintainability):
In awk, no need to pre-initialize integers to zero (-v found=0);
the cast with !found works without initializing found to zero.
There's absolutely no reason to have { if (condition) { ... } } when
condition { ... } will do and is the preferred syntax.
There's no need for END {statement;} when END { statement } will do.
Since we moved the calculation of percentage to right before the call
to bsddialog, there's no reason to perform nested if's over awk's
exit status. Add comments clarifying the return status meaning.
Remove an unnecessary ;; on the case fall-back (*). The fall-back
clause will never have another pattern after it and will always be
the last pattern, and as-such the clause terminator is entirely
optional (adding it here has zero value).
MFC after: 2 weeks