Reputation: 36
I have a kernel file located inside a cpio archive and I would like to calculate it's sha256sum.
For that I redirected the archive output to the standard output and piped through sha256sum
.
I get the sum by using awk
.
KERNEL_CHECKSUM=$(cpio --to-stdout -i kernel.fat16 < archive.cpio | sha256sum | awk '{print $1}')
This command works when it runs on a terminal. When run as a script, the checksum is not correctly calculated.
I suspect something related with the standard output but was unable to find the issue.
Upvotes: 0
Views: 365