Browse files

Added two new fields to the YAML file built by the build_iso_yaml.rb …

…file that contain the sha256 checksums for the vmlinuz and core.gz files contained in the ISO (used to check for integrity of these two files during the iPXE-boot process). Also changed the existing kernel and initrd fields in this file so that they included relative paths (from the root of the ISO) to these two files (boot/vmlinuz and boot/core.gz, respectively). Finally, made changes to the file so that the new CLI for the build_iso_yaml.rb file is used (now have to pass in 4 arguments, not just two; have added the paths to the kernel and initrd files as inputs to the build_iso_yaml.rb script)
  • Loading branch information...
Tom McSweeney
Tom McSweeney committed Mar 20, 2012
1 parent b0e4480 commit e2c58bc86e4c34bf10d800ad56d7a9950735ebe2
Showing with 47 additions and 8 deletions.
  1. +46 −7 iso-build-files/build_iso_yaml.rb
  2. +1 −1 iso-build-files/
@@ -10,26 +10,65 @@
# @author Tom McSweeney
require 'yaml'
require 'digest/sha2'
if ARGV.length != 2
puts " (example #{$0} /tmp v0.2.1.0"
def get_file_sha2_hash(path_to_file)
if !File.exist?(path_to_file)
return nil
file_h =, 'r') do |fh|
while buffer =
file_h << buffer
if ARGV.length != 4
puts "USAGE: #{$0} dir-name iso-version kernel-path initrd-path"
puts " (example #{$0} tmp v0.2.1.0 boot/vmlinuz boot/core.gz"
# take the first argument as the directory to create the YAML file in
dir_name = ARGV[0]
# if the named file doesn't exist or it does and it isn't a directory, then exit
# if the path passed as the directory name doesn't exist ()or it does and
# it isn't a directory), then exit
if !File.exist?(dir_name) || !
puts "#{$0} Error: '#{dir_name}' is not a directory"
# second argument is the iso_version
iso_version = ARGV[1]
# third argument is the path to the kernel image (assumed to be under the directory
# passed as the first argument)
kernel_path = ARGV[2]
path_to_file = dir_name + File::SEPARATOR + kernel_path
unless (kernel_sha2 = get_file_sha2_hash(path_to_file))
puts "#{$0} Error: '#{path_to_file}' is not a file"
# and the fourth argument is the path to the initrd image (again, assumed to be under
# the directory passed as the first argument)
initrd_path = ARGV[3]
path_to_file = dir_name + File::SEPARATOR + initrd_path
unless (initrd_sha2 = get_file_sha2_hash(path_to_file))
puts "#{$0} Error: '#{path_to_file}' is not a file"
# build the YAML file
yaml_hash =
yaml_hash['iso_version'] = ARGV[1]
yaml_hash['kernel'] = 'vmlinuz'
yaml_hash['initrd'] = 'core.gz'
yaml_hash['iso_version'] = iso_version
yaml_hash['kernel'] = kernel_path
yaml_hash['kernel_sha2'] = kernel_sha2
yaml_hash['initrd'] = initrd_path
yaml_hash['initrd_sha2'] = initrd_sha2
yaml_hash['iso_build_time'] =
# and save it to the iso-metadata.yaml file in the specified directory
@@ -26,6 +26,6 @@ advdef -z4 core.gz
cp -p core.gz newiso/boot/
# build the YAML file needed for use in Razor, place it into the root of the
# ISO filesystem
./build_iso_yaml.rb newiso ${ISO_VERSION}
./build_iso_yaml.rb newiso ${ISO_VERSION} boot/vmlinuz boot/core.gz
# finally, build the ISO itself (using the contents of the newiso directory as input
mkisofs -l -J -R -V TC-custom -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/ -o ${ISO_NAME} newiso

0 comments on commit e2c58bc

Please sign in to comment.