pentoo-overlay/dev-util/catalyst/files/blake2.patch
2020-02-11 11:29:55 -05:00

70 lines
3.5 KiB
Diff

diff --git a/catalyst/hash_utils.py b/catalyst/hash_utils.py
index 1134f50..dc3a8d6 100644
--- a/catalyst/hash_utils.py
+++ b/catalyst/hash_utils.py
@@ -11,6 +11,7 @@ from catalyst.support import CatalystError
# fields = ["func", "cmd", "args", "id"]
HASH_DEFINITIONS = {
"adler32" :["calc_hash2", "shash", ["-a", "ADLER32"], "ADLER32"],
+ "blake2" :["calc_hash", "b2sum", [ ], "BLAKE2"],
"crc32" :["calc_hash2", "shash", ["-a", "CRC32"], "CRC32"],
"crc32b" :["calc_hash2", "shash", ["-a", "CRC32B"], "CRC32B"],
"gost" :["calc_hash2", "shash", ["-a", "GOST"], "GOST"],
@@ -94,9 +95,11 @@ class HashMap(object):
args = [_hash.cmd]
args.extend(_hash.args)
args.append(file_)
+ log.debug('args = %r', args)
source = Popen(args, stdout=PIPE)
- mylines = source.communicate()[0]
- mylines=mylines[0].split()
+ output = source.communicate()
+ mylines = output[0].decode('ascii')
+ log.debug('output = %s', mylines)
result=mylines[0]
log.info('%s (%s) = %s', _hash.id, file_, result)
return result
diff --git a/etc/catalyst.conf b/etc/catalyst.conf
index 5a5eedb..ee014c1 100644
--- a/etc/catalyst.conf
+++ b/etc/catalyst.conf
@@ -8,7 +8,7 @@
# special "auto" keyword will skip digests that the system does not support,
# and if it's the only keyword given, will default to enabling all digests.
# Supported hashes:
-# adler32, crc32, crc32b, gost, haval128, haval160, haval192, haval224,
+# adler32, blake2, crc32, crc32b, gost, haval128, haval160, haval192, haval224,
# haval256, md2, md4, md5, ripemd128, ripemd160, ripemd256, ripemd320, sha1,
# sha224, sha256, sha384, sha512, snefru128, snefru256, tiger, tiger128,
# tiger160, whirlpool
@@ -40,7 +40,7 @@ envscript="/etc/catalyst/catalystrc"
# seedcache, etc. The default and fastest is crc32. You should not ever need
# to change this unless your OS does not support it.
# Supported hashes:
-# adler32, crc32, crc32b, gost, haval128, haval160, haval192, haval224,
+# adler32, blake2, crc32, crc32b, gost, haval128, haval160, haval192, haval224,
# haval256, md2, md4, md5, ripemd128, ripemd160, ripemd256, ripemd320, sha1,
# sha224, sha256, sha384, sha512, snefru128, snefru256, tiger, tiger128,
# tiger160, whirlpool
diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 8338e30..92efaa8 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -94,12 +94,14 @@ else
mkisofs_zisofs_opts=""
fi
-#we want to create a sha512sum for every file on the iso so we can verify it
-#from genkernel during boot. Here we make a function to create the sha512sums
+#we want to create a checksum for every file on the iso so we can verify it
+#from genkernel during boot. Here we make a function to create the sha512sums, and blake2sums
isoroot_checksum() {
echo "Creating checksums for all files included in the iso, please wait..."
- find "${clst_target_path}" -type f ! -name 'isoroot_checksums' ! -name 'isolinux.bin' -exec sha512sum {} + > "${clst_target_path}"/isoroot_checksums
+ find "${clst_target_path}" -type f ! -name 'isoroot_checksums' ! -name 'isolinux.bin' ! -name 'isoroot_b2sums' -exec sha512sum {} + > "${clst_target_path}"/isoroot_checksums
${clst_sed} -i "s#${clst_target_path}/\?##" "${clst_target_path}"/isoroot_checksums
+ find "${clst_target_path}" -type f ! -name 'isoroot_checksums' ! -name 'isolinux.bin' ! -name 'isoroot_b2sums' -exec b2sum {} + > "${clst_target_path}"/isoroot_b2sums
+ ${clst_sed} -i "s#${clst_target_path}/\?##" "${clst_target_path}"/isoroot_b2sums
}
run_mkisofs() {