Personal tools
You are here: Home Team Members Scott Glaser AKA Sonar_Guy ISO_Testing isotester.sh

isotester.sh

by scott_glaser last modified Jan 30, 2007 11:00 AM

The fruits of my labor, this is the first iteration of a DVD ISO tester script. This script wil take a DVD ISO from a test directory, modify the DVD ISO to allow for an unattended install using kickstart and insert the test package. Modify a vmware guest, then load the test image from the DVD ISO. TODO: A way to pause the script till the testing is completed, possibly check the guest os directory and monitor the writelock files. Need a way to test CD ISOs in the same manner, they are trickier as there will be 4 - 6 iso images and only the first one needs to be modififed. The build is not an issue just need to pop the iso names into the .VMX file and have a CD device for each ISO image.

isotester.sh — text/x-sh, 4Kb

File contents

#!/bin/bash
# Project:      ISO Automated Test Script
# Version:      1
# Date Started: 2007-01-10
# Written By: Scott Glaser
# Copyright (c) 2006 by Scott Glaser. This material may be distributed only subject to the terms and
# conditions set forth in the Open Publication License, v1.0 or later. Distribution of substantively
# modified versions of this document is prohibited without the explicit permission of the copyright
# holder. Distribution of the work or derivative of the work in any standard (paper) book form is
# prohibited unless prior permission is obtained from the copyright holder.(the latest version is
# presently available at http://www.opencontent.org/openpub/).
#
# For more information contact: sonar_guy<AT>c-ccom.com
#
# NOTES: 

VM_DIR=/var/lib/vmware/Virtual\ Machines	# Path to virtural machines, this will vary based on you installation.
VM_IMAGE=Test_Builder			     	# Name/Directory of the virtural machine image
ISO_TEST=/ISO_TEST/				# Path to directory where re-spin ISOs are deposited
ISO_BUILD=/iso_rebuild				# Path to ISO rebuild directory structure
ISO_MOUNT=/iso_rebuild/pre_test			# Mount point to which the unmodified ISO is mounted
ISO_FILES=/iso_rebuild/testing_files		# Path to the files that are required to test the ISOs
ISO_MOD=/iso_rebuild/test_prep			# Path to the modified ISO so the correct files can be insterted
ISO_TESTING=/ISO_testing



# Verify the SHA1SUM of the ISO File.
function sha1sum_image()
{
	echo "This is the subfunction in which we check the sha1sum against the SHA1SUM file"		#Insert Code here
	echo "This feature is to be implemented at a later date."
}

# Prepare the ISO.
function prep_iso()
{
        echo "This is the subfunction in which we prepare the ISO for testing"		#Insert Code here
	echo "Copying $file to ISO rebuild directory..."
	#mv $file $ISO_BUILD/$file							#This is the actual command
	cp -Rp $file $ISO_BUILD/$file							#This line is for testing
	echo "Mounting $file to $ISO_MOUNT"
	mount -o loop $file $ISO_MOUNT							#Mount the ISO for copying
	echo "Copying the contents of $file to a new directory"
	echo "to allow for file insertion and modification. . ."
	cp -a $ISO_MOUNT/.  $ISO_MOD/							#Copies the contents of the iso for modificaton
	echo "Inserting Isolinux configuration file"					
	rm -rf $ISO_MOD/isolinux/isolinux.cfg						#Removes unmodified file
	cp -Rp $ISO_FILES/isolinux.cfg $ISO_MOD/isolinux/isolinux.cfg			#Inserts the testing file
	echo "Inserting the Kickstart configuration file"				
	cp -Rp $ISO_FILES/ks.cfg $ISO_MOD/ks.cfg					#Inserts the kickstart config
	echo "Inserting the testing package"						
	cp -Rp $ISO_FILES/testing_package.sh $ISO_MOD/testing_package.sh		#Inserts the test package
	echo "Done modifying the ISO for testing, Creating new ISO. . ."
	mkisofs -o $ISO_TESTING/$file -r -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T $ISO_MOD/	#Create the modified ISO
	echo "ISO Creation complete"							
	echo "Unmounting the Original ISO."
	umount $ISO_MOUNT								#Unmount the original ISO
	echo "Cleaning out $ISO_MOD"	
	rm -rf $ISO_MOD/*								#Clean out the working directory
	echo "ISO Preparations are Complete"
}

# Prepare the VMware guest.
function prep_vm()
{
        echo "This is the subfunction in which we prep the VMware guest to test the iso"	#Insert Code here
	echo "Move new vmware guest into place for testing"
	rm -rf /var/lib/vmware/Virtual\ Machines/Test_Builder
	cp -a /var/lib/vmware/Virtual\ Machines/temp_build /var/lib/vmware/Virtual\ Machines/Test_Builder	#This moves the new environment into place
	echo "Modifying Test_Builder.vmx to look at the proper ISO file."
	sed -i -e "s#/ISO_testing/FC-6-i386-DVD.iso#/ISO_testing/$file#" /var/lib/vmware/Virtual\ Machines/Test_Builder/Test_Builder.vmx
	echo "Completed preparation of the vmware guest"
}

# Test the ISO.
function iso_test()
{
        echo "This is the subfunction where each ISO is tested"			#Insert Code here
	/usr/bin/vmware-cmd /var/lib/vmware/Virtual\ Machines/Test_Builder/Test_Builder.vmx start
}

# Clean-Up.
function test_clean()
{
        echo "This is the subfunction where the test environment is cleaned after testing"	#Insert Code here
}

cd $ISO_TEST
for file in *; do sha1sum_image; prep_iso; prep_vm; iso_test; test_clean; done



Document Actions
Log in


Forgot your password?
New user?