pentoo-overlay/dev-util/catalyst/files/isoroot_checksum.patch

59 lines
4 KiB
Diff

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 08598e5..d807c17 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -78,6 +78,15 @@ else
mkisofs_zisofs_opts=""
fi
+#we want to create an md5sum for every file on the iso so we can verify it
+#from genkernel during boot. Here we make a function to create the md5sum
+#and then we call it from arches where it makes sense, starting with amd64/x86
+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
+ sed -i "s#${clst_target_path}##" "${clst_target_path}"/isoroot_checksums
+}
+
# Here we actually create the ISO images for each architecture
case ${clst_hostarch} in
alpha)
@@ -262,16 +271,19 @@ 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"
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"
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"
@@ -279,15 +291,18 @@ case ${clst_hostarch} in
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"
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"
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"
fi