pentoo-overlay/dev-util/catalyst/files/isoroot_checksum.patch
2015-09-19 23:09:39 -04:00

74 lines
4.8 KiB
Diff

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 70f0fac..77c6613 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -28,7 +28,7 @@ class livecd_stage2(StageBase):
"livecd/rcdel","livecd/fsscript","livecd/xinitrc",\
"livecd/root_overlay","livecd/users","portage_overlay",\
"livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\
- "gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"])
+ "gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid","livecd/verify"])
StageBase.__init__(self,spec,addlargs)
if "livecd/type" not in self.settings:
diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 5e8cdc3..2a96746 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -82,6 +82,17 @@ 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 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
+}
+
# Here we actually create the ISO images for each architecture
case ${clst_hostarch} in
alpha)
@@ -264,16 +275,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"
@@ -281,15 +295,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