summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/combined-ext-image.sh2
-rw-r--r--scripts/combined-image.sh2
-rwxr-xr-xscripts/download.pl8
-rwxr-xr-xscripts/ipkg-make-index.sh2
-rw-r--r--scripts/om-fwupgradecfg-gen.sh10
5 files changed, 10 insertions, 14 deletions
diff --git a/scripts/combined-ext-image.sh b/scripts/combined-ext-image.sh
index 374fe6e..0c7b1d9 100755
--- a/scripts/combined-ext-image.sh
+++ b/scripts/combined-ext-image.sh
@@ -47,7 +47,7 @@ while [ "$#" -gt 1 ]
[ ! -f "$file" ] && echo "$ME: Not a valid file: $file" && usage
FILES="$FILES $file"
- md5=$(cat "$file" | md5sum -)
+ md5=$(mkhash md5 "$file")
printf "%-32s%08x%32s" "$filename" $(stat -c "%s" "$file") "${md5%% *}" >> $IMG_OUT
shift 2
done
diff --git a/scripts/combined-image.sh b/scripts/combined-image.sh
index 5472b2c..4e00cb8 100644
--- a/scripts/combined-image.sh
+++ b/scripts/combined-image.sh
@@ -16,7 +16,7 @@ dd if="$1" of="$kern" bs=$BLKSZ conv=sync 2>/dev/null
dd if="$2" of="$root" bs=$BLKSZ conv=sync 2>/dev/null
# Calculate md5sum over combined kernel and rootfs image.
-md5=$(cat "$kern" "$root" | md5sum -)
+md5=$(cat "$kern" "$root" | mkhash md5)
# Write image header followed by kernel and rootfs image.
# The header is padded to 64k, format is:
diff --git a/scripts/download.pl b/scripts/download.pl
index ad8b837..0398c56 100755
--- a/scripts/download.pl
+++ b/scripts/download.pl
@@ -65,12 +65,8 @@ sub hash_cmd() {
my $len = length($file_hash);
my $cmd;
- $len == 64 and return "openssl dgst -sha256 | sed -e 's,.*= ,,'";
- $len == 32 and do {
- my $cmd = which("md5sum") || which("md5") || die 'no md5 checksum program found, please install md5 or md5sum';
- chomp $cmd;
- return $cmd;
- };
+ $len == 64 and return "mkhash sha256";
+ $len == 32 and return "mkhash md5";
return undef;
}
diff --git a/scripts/ipkg-make-index.sh b/scripts/ipkg-make-index.sh
index c99c5fe..dcd11ca 100755
--- a/scripts/ipkg-make-index.sh
+++ b/scripts/ipkg-make-index.sh
@@ -18,7 +18,7 @@ for pkg in `find $pkg_dir -name '*.ipk' | sort`; do
[[ "$name" = "libc" ]] && continue
echo "Generating index for package $pkg" >&2
file_size=$(ls -l $pkg | awk '{print $5}')
- sha256sum=$(openssl dgst -sha256 $pkg | awk '{print $2}')
+ sha256sum=$(mkhash sha256 $pkg)
# Take pains to make variable value sed-safe
sed_safe_pkg=`echo $pkg | sed -e 's/^\.\///g' -e 's/\\//\\\\\\//g'`
tar -xzOf $pkg ./control.tar.gz | tar xzOf - ./control | sed -e "s/^Description:/Filename: $sed_safe_pkg\\
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh
index 6c3b74c..bb30252 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))