commit:     dc295a5569353ef7a4f42a9b4796fd36f9520e68
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 13 16:40:08 2020 +0000
Commit:     Rick Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Thu Feb 13 16:40:48 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=dc295a55

update livecd/verify to control digest type

plus document it right

Signed-off-by: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo.org>

 examples/livecd-stage2_template.spec |  7 ++++---
 targets/support/create-iso.sh        | 22 +++++++++++++++++-----
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/examples/livecd-stage2_template.spec 
b/examples/livecd-stage2_template.spec
index cc5cf00e..7dd64c3f 100644
--- a/examples/livecd-stage2_template.spec
+++ b/examples/livecd-stage2_template.spec
@@ -331,10 +331,11 @@ boot/kernel/gentoo/machine_type:
 # boot/kernel/gentoo/console: tty0 ttyS0
 boot/kernel/gentoo/console:
 
-# This feature will make sha512 checksums for every file in the iso (including 
files provided by livecd/overlay
+# This feature will make sha512, blake2, or both checksums for every file in 
the iso (including files provided by livecd/overlay
 # These checksums can be verified at boot using the genkernel option "verify" 
added to the kernel line.
-# Currently this feature will be enabled if livecd/verify is defined to *any* 
value, leave commented to disable.
-#livecd/verify: true
+# Currently this feature will generate both checksums if livecd/verify is 
defined to *any* value other than "blake2" or "sha512"
+# No checksums are generated if this is left commented.
+#livecd/verify: sha512
 
 # This feature controls the depclean run after fsscript and before unmerge.
 # The default is unset, and will run emerge --depclean --with-bdeps=n which 
results

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 92efaa8b..ed581763 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -98,14 +98,26 @@ fi
 #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' ! -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
+       if [ -z "${1}" ] || [ "${1}" = "sha512" ]; then
+               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
+       fi
+       if [ -z "${1}" ] || [ "${1}" = "blake2" ]; then
+               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
+       fi
 }
 
 run_mkisofs() {
-       [ -n "${clst_livecd_verify}" ] && isoroot_checksum
+       if [ -n "${clst_livecd_verify}" ]; then
+               if [ "${clst_livecd_verify}" = "sha512" ]; then
+                       isoroot_checksum sha512
+               elif [ "${clst_livecd_verify}" = "blake2" ]; then
+                       isoroot_checksum blake2
+               else
+                       isoroot_checksum
+               fi
+       fi
        echo "Running \"mkisofs ${@}\""
        mkisofs "${@}" || die "Cannot make ISO image"
 }

Reply via email to