diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-12-25 16:40:05 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2017-01-05 11:09:12 +0100 |
commit | 84bd74057f0d2543ddbc7de2351b0a310df329c6 (patch) | |
tree | 7c7e358aedf5930eeba27392e3123702503556e5 /scripts/om-fwupgradecfg-gen.sh | |
parent | dad48c6438f0a4c42ad34842a88e82280d971d90 (diff) | |
download | upstream-84bd74057f0d2543ddbc7de2351b0a310df329c6.tar.gz upstream-84bd74057f0d2543ddbc7de2351b0a310df329c6.tar.bz2 upstream-84bd74057f0d2543ddbc7de2351b0a310df329c6.zip |
build: use mkhash to replace various quirky md5sum/openssl calls
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'scripts/om-fwupgradecfg-gen.sh')
-rw-r--r-- | scripts/om-fwupgradecfg-gen.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh index 6c3b74cc1c..bb30252aa0 100644 --- a/scripts/om-fwupgradecfg-gen.sh +++ b/scripts/om-fwupgradecfg-gen.sh @@ -41,16 +41,16 @@ esac CHECK_BS=65536 KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH") -KERNEL_MD5=$(md5=$(md5sum $KERNEL_PATH); echo ${md5%% *}) -KERNEL_SHA256=$(openssl dgst -sha256 $KERNEL_PATH | awk '{print $2}') +KERNEL_MD5=$(mkhash md5 $KERNEL_PATH) +KERNEL_SHA256=$(mkhash sha256 $KERNEL_PATH) KERNEL_PART_SIZE=$(size=$(($KERNEL_SIZE / $FLASH_BS)); [ $(($size * $FLASH_BS)) -lt $KERNEL_SIZE ] && size=$(($size + 1)); echo $(($size * $FLASH_BS / 1024))) ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE * 1024))); printf "0x%x" $addr) ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") ROOTFS_CHECK_BLOCKS=$((($ROOTFS_SIZE / $CHECK_BS) - $MD5_SKIP_BLOCKS)) -ROOTFS_MD5=$(md5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | md5sum); echo ${md5%% *}) -ROOTFS_MD5_FULL=$(md5=$(md5sum $ROOTFS_PATH); echo ${md5%% *}) -ROOTFS_SHA256_FULL=$(openssl dgst -sha256 $ROOTFS_PATH | awk '{print $2}') +ROOTFS_MD5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | mkhash md5) +ROOTFS_MD5_FULL=$(mkhash md5 $ROOTFS_PATH) +ROOTFS_SHA256_FULL=$(mkhash sha256 $ROOTFS_PATH) ROOTFS_CHECK_SIZE=$(printf '0x%x' $(($ROOTFS_CHECK_BLOCKS * $CHECK_BS))) ROOTFS_PART_SIZE=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE)) |