Openwrt/scripts
Paul Spooren fcd3e13779 scripts: mkhash fail on hashing a folder
mkhash currently returns the hash of an empty input when trying to hash
a folder. This can be missleading in caseswhere e.g. an env variable is
undefined which should contain a filename. `mkhash ./path/to/$FILE`
would exit with code 0 and return a legit looking checksum.

A better behaviour would be to fail with exit code 1, which imitates the
behaviour of `md5sum` and `sha256sum`.

To avoid hashing of folders the `stat()` is checked.

Hashing empty inputs result in the following checksums:
md5: d41d8cd98f00b204e9800998ecf8427e
sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-11-09 10:54:29 +00:00
..
config
flashing
arm-magic.sh
brcmImage.pl
bundle-libraries.sh
cfe-bin-header.py
cfe-partition-tag.py
cfe-wfi-tag.py
checkpatch.pl
clang-gcc-wrapper
clean-package.sh
cleanfile
cleanpatch
combined-ext-image.sh
combined-image.sh
config.guess
config.rpath
config.sub
deptest.sh
diffconfig.sh
dl_cleanup.py
dl_github_archive.py
download.pl
dump-target-info.pl
env
ext-toolchain.sh
feeds
fixup-makefile.pl
functions.sh
gen_image_generic.sh
gen-dependencies.sh
get_source_date_epoch.sh
getver.sh
ipkg-build
ipkg-make-index.sh
ipkg-remove
json_add_image_info.py
json_overview_image_info.py
kconfig.pl
linksys-image.sh
make-ipkg-dir.sh
md5sum
metadata.pm
mkhash.c scripts: mkhash fail on hashing a folder 2020-11-09 10:54:29 +00:00
mkits-qsdk-ipq-image.sh
mkits.sh
om-fwupgradecfg-gen.sh
package-metadata.pl
pad_image
patch-kernel.sh
patch-specs.sh
portable_date.sh
qemustart
redboot-script.pl
relink-lib.sh
remote-gdb
rstrip.sh
sercomm-crypto.py
sercomm-partition-tag.py
sercomm-payload.py
sign_images.sh
slugimage.pl
srecimage.pl
strip-kmod.sh
symlink-tree.sh
sysupgrade-tar.sh
target-metadata.pl
time.pl
timestamp.pl
ubinize-image.sh