catalyst: test new isoroot_checksum patch

This commit is contained in:
Rick Farina (Zero_Chaos) 2015-09-21 09:51:38 -04:00
parent 1fdc7f7256
commit 7038132ca2

View file

@ -11,11 +11,28 @@ index 70f0fac..77c6613 100644
StageBase.__init__(self,spec,addlargs)
if "livecd/type" not in self.settings:
diff --git a/examples/livecd-stage2_template.spec b/examples/livecd-stage2_template.spec
index c2c6bf3..b0aa66e 100644
--- a/examples/livecd-stage2_template.spec
+++ b/examples/livecd-stage2_template.spec
@@ -331,6 +331,12 @@ 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
+# 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.
+# Currently this feature is limited to x86/amd64 and will do nothing on other arches.
+#livecd/verify: true
+
# This is a list of packages that will be unmerged after all the kernels have
# been built. There are no checks on these packages, so be careful what you
# add here. They can potentially break your CD.
diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 5e8cdc3..2a96746 100755
index 5e8cdc3..364eed7 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -82,6 +82,17 @@ else
@@ -82,6 +82,21 @@ else
mkisofs_zisofs_opts=""
fi
@ -23,52 +40,58 @@ index 5e8cdc3..2a96746 100755
+#from genkernel during boot. Here we make a function to create the sha512sum
+#and then we call it from arches where it makes sense, starting with amd64/x86
+isoroot_checksum() {
+ if [ -n "${clst_livecd_verify}" ]; then
+ 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
+ sed -i "s#${clst_target_path}##" "${clst_target_path}"/isoroot_checksums
+ fi
+ 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
+ sed -i "s#${clst_target_path}##" "${clst_target_path}"/isoroot_checksums
+}
+
+run_mkisofs() {
+ [ -n "${clst_livecd_verify}" ] && isoroot_checksum
+ echo "Running \"mkisofs ${1}\""
+ mkisofs ${1} || die "Cannot make ISO image"
+}
+
# Here we actually create the ISO images for each architecture
case ${clst_hostarch} in
alpha)
@@ -264,16 +275,19 @@ case ${clst_hostarch} in
@@ -264,34 +279,28 @@ case ${clst_hostarch} in
mv ${clst_target_path}/boot/* ${clst_target_path}/isolinux
rm -r ${clst_target_path}/boot
echo "Creating ISO using ISOLINUX bootloader"
+ isoroot_checksum
echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/ || die "Cannot make ISO image"
- echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
- mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/ || die "Cannot make ISO image"
+ run_mkisofs "-J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
isohybrid ${1}
elif [ -e ${clst_target_path}/gentoo.efimg ]
then
+ isoroot_checksum
echo "Creating ISO using both ISOLINUX and EFI bootloader"
echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b gentoo.efimg -c boot.cat -no-emul-boot -z ${clst_target_path}/"
mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b gentoo.efimg -c boot.cat -no-emul-boot -z ${clst_target_path}/ || die "Cannot make ISO image"
- echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b gentoo.efimg -c boot.cat -no-emul-boot -z ${clst_target_path}/"
- mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b gentoo.efimg -c boot.cat -no-emul-boot -z ${clst_target_path}/ || die "Cannot make ISO image"
+ run_mkisofs "-J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b gentoo.efimg -c boot.cat -no-emul-boot -z ${clst_target_path}/"
fi
else
+ isoroot_checksum
echo "Creating ISO using ISOLINUX bootloader"
echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/ || die "Cannot make ISO image"
@@ -281,15 +295,18 @@ case ${clst_hostarch} in
- echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
- mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/ || die "Cannot make ISO image"
+ run_mkisofs "-J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
isohybrid ${1}
fi
elif [ -e ${clst_target_path}/boot/grub/stage2_eltorito ]
then
+ isoroot_checksum
echo "Creating ISO using GRUB bootloader"
echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/ || die "Cannot make ISO image"
- echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
- mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/ || die "Cannot make ISO image"
+ run_mkisofs "-J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path}/"
elif [ -e ${clst_target_path}/gentoo.efimg ]
then
+ isoroot_checksum
echo 'Creating ISO using EFI bootloader'
echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}/"
mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}/ || die "Cannot make ISO image"
- echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}/"
- mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}/ || die "Cannot make ISO image"
+ run_mkisofs "-J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} -b gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}/"
else
+ isoroot_checksum
echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}/"
mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path}/ || die "Cannot make ISO image"
- echo "mkisofs -J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}/"
- mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} ${clst_target_path}/ || die "Cannot make ISO image"
+ run_mkisofs "-J -R -l ${mkisofs_zisofs_opts} -V \"${clst_iso_volume_id}\" -o ${1} ${clst_target_path}/"
fi
;;
esac