armbian-next: write_image_to_device: if SKIP_VERIFY=no, don't waste time checksumming the image, it won't be used

This commit is contained in:
Ricardo Pardini
2022-07-07 13:45:21 +02:00
parent a02647862a
commit 379b7d6f19

View File

@@ -3,13 +3,16 @@ function write_image_to_device() {
local image_file="${1}"
local device="${2}"
if [[ $(lsblk "${device}" 2> /dev/null) && -f "${image_file}" ]]; then
# create sha256sum if it does not exist. we need it for comparison, later.
local if_sha=""
if [[ -f "${image_file}.img.sha" ]]; then
# shellcheck disable=SC2002 # cat most definitely is useful. she purrs.
if_sha=$(cat "${image_file}.sha" | awk '{print $1}')
else
if_sha=$(sha256sum -b "${image_file}" | awk '{print $1}')
if [[ "${SKIP_VERIFY}" != "yes" ]]; then
# create sha256sum if it does not exist. we need it for comparison, later.
local if_sha=""
if [[ -f "${image_file}.img.sha" ]]; then
# shellcheck disable=SC2002 # cat most definitely is useful. she purrs.
if_sha=$(cat "${image_file}.sha" | awk '{print $1}')
else
if_sha=$(sha256sum -b "${image_file}" | awk '{print $1}')
fi
fi
display_alert "Writing image" "${device} ${if_sha}" "info"