Index: branches/blackosx/package/Scripts/Standard/postinstall =================================================================== --- branches/blackosx/package/Scripts/Standard/postinstall (revision 1544) +++ branches/blackosx/package/Scripts/Standard/postinstall (revision 1545) @@ -71,7 +71,7 @@ # Double check we can see the selected partition and it's of the right type # if not the following script returns to indicate failure. -"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetVolume}" "${targetDeviceTemp}" "${scriptDir}" +"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}" returnValue=$? if [ ${returnValue}=0 ]; then # OK to proceed @@ -98,7 +98,7 @@ # the following script returns 0 if we can proceed # with writing the boot files, and 1 for not. - "$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" + "$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" "${targetVolume}" "${scriptDir}" diskupdate=$? @@ -133,20 +133,25 @@ if [ "${fatType}" = 1 ] && [ "${partitionTable}" = 3 ]; then echo "ERROR: - Can't install to a device using FAT16" # Write error to Chameleon_Error_Log file - "$scriptDir"InstallLog.sh "${targetVolume}" "Cannot install to a device using FAT16" + "$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Cannot install to a device using FAT16" else # Continue if the selected device is not a FAT16 format device - # If diskupdate is flagged as 0 then the stage 0 loader can be written to the MBR - if [ ${diskupdate} = 0 ]; then - "$scriptDir"WriteChameleonStage0.sh "${diskupdate}" "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolume}" "${scriptDir}" + if [ ${diskupdate} = "0" ]; then + echo "Diskupdate = true, so the stage 0 loader can be written to the MBR" + + # Write the stage 0 loader to the MBR + "$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolume}" "${scriptDir}" + else + echo "Diskupdate = false, so didn't write the stage 0 loader to the MBR." + "$scriptDir"InstallLog.sh "${targetVolume}" "Stage 0 loader not written to ${targetDisk}." fi # Write the stage 1 loader to the partition boot sector - "$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" + "$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}" # Write the stage 2 loader to the root of the selected partition - "$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" + "$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}" # Set the active partition ONLY if Windows is not installed "$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}" "${scriptDir}" Index: branches/blackosx/package/Scripts/EFI/postinstall =================================================================== --- branches/blackosx/package/Scripts/EFI/postinstall (revision 1544) +++ branches/blackosx/package/Scripts/EFI/postinstall (revision 1545) @@ -36,11 +36,11 @@ stage1LoaderFAT="boot1f32" stage2Loader="boot" -targetVolumeTemp=$3 -targetDeviceTemp=$( df "${targetVolumeTemp}" | sed -n '2p' | awk '{print $1}' ) +targetVolumeChosenByUser=$3 +targetDeviceChosenByUser=$( df "${targetVolumeChosenByUser}" | sed -n '2p' | awk '{print $1}' ) targetVolume="/Volumes/EFI" -targetDevice=${targetDeviceTemp%s*}s1 +targetDevice=${targetDeviceChosenByUser%s*}s1 targetDeviceRaw=${targetDevice/disk/rdisk} targetDisk=${targetDevice%s*} targetDiskRaw=${targetDisk/disk/rdisk} @@ -57,8 +57,8 @@ echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}" echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}" echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}" -echo "DEBUG: targetVolumeTemp: Volume is ${targetVolumeTemp}" -echo "DEBUG: targetDeviceTemp: Volume device is ${targetDeviceTemp}" +echo "DEBUG: targetVolumeChosenByUser: Volume is ${targetVolumeChosenByUser}" +echo "DEBUG: targetDeviceChosenByUser: Volume device is ${targetDeviceChosenByUser}" echo "DEBUG: targetVolume: Volume is ${targetVolume}" echo "DEBUG: targetDevice: Volume device is ${targetDevice}" echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}" @@ -71,15 +71,15 @@ # Check to see if the selected disk uses a GPT -bootuuid=$( diskutil info "$targetDeviceTemp" | grep Volume\ UUID | awk {'print $3'} ) -partitiontable=$( diskutil list ${targetDeviceTemp%s*} | sed -n '3p' | awk '{print $2}' ) +bootuuid=$( diskutil info "$targetDeviceChosenByUser" | grep Volume\ UUID | awk {'print $3'} ) +partitiontable=$( diskutil list ${targetDeviceChosenByUser%s*} | sed -n '3p' | awk '{print $2}' ) if [ ${partitiontable} = "GUID_partition_scheme" ]; then echo "Confirm this is a GPT partitioned disk." - # Double check we can see the selected partition and it's of the right type + # Double check we can see the selected partition, it's of the right type and /Volumes/EFI exists. - "$scriptDir"CheckProceed.sh "${targetVolumeTemp}" "${targetVolume}" "${targetDeviceTemp}" "${scriptDir}" + "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" returnValue=$? if [ ${returnValue} = 0 ]; then # OK to proceed @@ -88,7 +88,7 @@ # Does a GRUB or Linux loader already exist in the disk's MBR? # The script returns 1 if yes, 0 if no. - "$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}" "${targetVolumeTemp}" "${scriptDir}" + "$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}" returnValue=$? if [ ${returnValue} = 0 ]; then # OK to proceed @@ -106,7 +106,7 @@ # the following script returns 0 if we can proceed # with writing the boot files, and 1 for not. - "$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" + "$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" "${targetVolumeChosenByUser}" "${scriptDir}" diskupdate=$? @@ -129,26 +129,29 @@ # the following script returns 0 if it succeeds # the following script returns 1 if it fails to un-mount any EFI volume - "$scriptDir"UnMountEFIvolumes.sh "${targetVolumeTemp}" "${scriptDir}" + "$scriptDir"UnMountEFIvolumes.sh "${targetVolumeChosenByUser}" "${scriptDir}" returnValue=$? if [ ${returnValue} = 0 ]; then # OK to proceed + if [ ${diskupdate} = "0" ]; then + echo "Diskupdate = true, so the stage 0 loader can be written to the MBR" - # If diskupdate is flagged as 0 then the stage 0 loader can be written to the MBR - if [ ${diskupdate} = 0 ]; then - "$scriptDir"WriteChameleonStage0.sh "${diskupdate}" "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolumeTemp}" "${scriptDir}" + # Write the stage 0 loader to the MBR + "$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}" + else + echo "Diskupdate = false, so didn't write the stage 0 loader to the MBR." + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Stage 0 loader not written to ${targetDisk}." fi # Write the stage 1 loader to the partition boot sector - "$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${targetVolumeTemp}" "${targetDeviceRaw}" "${targetVolume}" + "$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${targetVolumeChosenByUser}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}" # Write the stage 2 loader to the root of the selected partition - "$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${targetVolumeTemp}" "${targetDevice}" "${targetVolume}" + "$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${targetVolumeChosenByUser}" "${targetDevice}" "${targetVolume}" "${scriptDir}" # Set the active partition ONLY if Windows is not installed - "$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeTemp}" "${scriptDir}" - + "$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeChosenByUser}" "${scriptDir}" fi fi fi @@ -172,7 +175,7 @@ # Create temporary file on target volume to notify # boot option scripts than EFI (ESP) option was chosen -echo "EFI" >"${targetVolumeTemp}"/.ChameleonEFI +echo "EFI" >"${targetVolumeChosenByUser}"/.ChameleonEFI echo "===============================================" echo "END - Main EFI System Partition Post-Install Script" Index: branches/blackosx/package/Scripts/Install/InstallLog.sh =================================================================== --- branches/blackosx/package/Scripts/Install/InstallLog.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/InstallLog.sh (revision 1545) @@ -4,7 +4,7 @@ echo "InstallLog: Create/Append installation log" echo "**********************************************" -# Creates text file named 'Chameleon_Installer_Fail_Log.txt' +# Creates text file named 'Chameleon_Installer_Log.txt' # at the root of the target volume. This is to help show the # user why the installation process failed (even though the # package installer ends reading 'Installation Successful'. @@ -16,20 +16,20 @@ if [ "$#" -eq 2 ]; then logLocation="$1" verboseText="$2" - #echo "DEBUG: passed argument = $logLocation" - #echo "DEBUG: passed argument = $verboseText" + echo "DEBUG: passed argument = $logLocation" + echo "DEBUG: passed argument = $verboseText" else echo "Error - wrong number of values passed" exit 9 fi +logName="Chameleon_Installer_Log.txt" +logFile="${logLocation}"/$logName -logfile="${logLocation}"/Chameleon_Installer_Fail_Log.txt - -if [ -f "${logfile}" ]; then - echo "${verboseText}" >> "${logLocation}"/Chameleon_Installer_Fail_Log.txt +if [ -f "${logFile}" ]; then + echo "${verboseText}" >> "${logFile}" else - echo "${verboseText}" > "${logLocation}"/Chameleon_Installer_Fail_Log.txt + echo "${verboseText}" > "${logFile}" fi exit 0 \ No newline at end of file Index: branches/blackosx/package/Scripts/Install/WriteChameleonStage0.sh =================================================================== --- branches/blackosx/package/Scripts/Install/WriteChameleonStage0.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/WriteChameleonStage0.sh (revision 1545) @@ -4,17 +4,23 @@ echo "Write Chameleon Stage 0 Loader:" echo "*******************************" -# this script is passedÉ. +# Writes Chameleon stage 0 loader. -if [ "$#" -eq 7 ]; then - diskupdate="$1" - disksignature="$2" - stage0Loader="$3" - stage0Loaderdualboot="$4" - targetDisk="$5" - targetVolume="$6" - scriptDir="$7" - echo "DEBUG: passed argument for diskupdate = $diskupdate" +# Receives disksignature: 0 = Windows not found, 1 = Windows Found +# Receives stage0Loader: Name of file - boot0 +# Receives stage0Loaderdualboot: Name of file - boot0hfs +# Receives targetDisk: for example, /dev/disk3 +# Receives targetVolume: for example, /Volumes/USB +# Receives scriptDir: The location of the main script dir. + + +if [ "$#" -eq 6 ]; then + disksignature="$1" + stage0Loader="$2" + stage0Loaderdualboot="$3" + targetDisk="$4" + targetVolume="$5" + scriptDir="$6" echo "DEBUG: passed argument for disksignature = $disksignature" echo "DEBUG: passed argument for stage0Loader = $stage0Loader" echo "DEBUG: passed argument for stage0Loaderdualboot = $stage0Loaderdualboot" @@ -26,22 +32,22 @@ exit 9 fi -if [ ${diskupdate} = "0" ]; then - echo "Diskupdate = true, so yes" - - if [ ${disksignature} = "0" ]; then - # ThereÕs no Windows disk signature then we can write boot0 + +if [ ${disksignature} = "0" ]; then + # ThereÕs no Windows disk signature so we can write boot0 - echo "Executing command: fdisk440 -u -f /usr/standalone/i386/${stage0Loader} -y ${targetDisk}" - "${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loader} -y ${targetDisk} - else - # Windows is also installed on the HDD and we need to write boot0hfs + echo "Executing command: fdisk440 -u -f /usr/standalone/i386/${stage0Loader} -y ${targetDisk}" + "${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loader} -y ${targetDisk} + "$scriptDir"InstallLog.sh "${targetVolume}" "Written boot0 to ${targetDisk}." +else + # Windows is also installed on the HDD so we need to write boot0hfs - echo "Executing command: /fdisk440 -u -f /usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}" - "${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk} - fi + echo "Executing command: /fdisk440 -u -f /usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}" + "${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk} + "$scriptDir"InstallLog.sh "${targetVolume}" "Written boot0hfs to ${targetDisk}." fi + echo "-----------------------------------------------" echo "" echo "" Index: branches/blackosx/package/Scripts/Install/WriteChameleonStage1.sh =================================================================== --- branches/blackosx/package/Scripts/Install/WriteChameleonStage1.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/WriteChameleonStage1.sh (revision 1545) @@ -4,21 +4,31 @@ echo "Write Chameleon Stage 1 Loader:" echo "*******************************" -# espformat code is 1 for HFS, 2 for MSDOS, 0 for unknown +# Writes Chameleon stage 1 loader. -if [ "$#" -eq 6 ]; then +# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown +# Receives stage1LoaderHFS: Name of file - boot1h +# Receives stage1LoaderFAT: Name of file - boot1f32 +# Receives selectedDestination: for example, /Volumes/USB +# Receives targetDeviceRaw: for example, /dev/disk3s1 +# Receives targetVolume: for example, /Volumes/USB +# Receives scriptDir: The location of the main script dir. + +if [ "$#" -eq 7 ]; then espformat="$1" stage1LoaderHFS="$2" stage1LoaderFAT="$3" selectedDestination="$4" targetDeviceRaw="$5" targetVolume="$6" + scriptDir="$7" echo "DEBUG: passed argument for espformat = $espformat" echo "DEBUG: passed argument for stage1LoaderHFS = $stage1LoaderHFS" echo "DEBUG: passed argument for stage1LoaderFAT = $stage1LoaderFAT" echo "DEBUG: passed argument for selectedDestination = $selectedDestination" echo "DEBUG: passed argument for targetDeviceRaw = $targetDeviceRaw" echo "DEBUG: passed argument for targetVolume = $targetVolume" + echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" exit 9 @@ -29,6 +39,8 @@ echo "Executing command: dd if=${selectedDestination}/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw}" dd if="${selectedDestination}"/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw} + + "$scriptDir"InstallLog.sh "${targetVolume}" "Written ${stage1LoaderHFS} to ${targetDeviceRaw}." fi if [ ${espformat} = "2" ]; then @@ -45,6 +57,8 @@ echo "Executing command: dd of=${targetDeviceRaw} count=1 bs=512 if=/tmp/newbs" dd if=/tmp/newbs of="${targetDeviceRaw}" count=1 bs=512 + + "$scriptDir"InstallLog.sh "${targetVolume}" "Written ${stage1LoaderFAT} to ${targetDeviceRaw}." fi echo "-----------------------------------------------" Index: branches/blackosx/package/Scripts/Install/WriteChameleonStage2.sh =================================================================== --- branches/blackosx/package/Scripts/Install/WriteChameleonStage2.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/WriteChameleonStage2.sh (revision 1545) @@ -4,22 +4,29 @@ echo "Write Chameleon Stage 2 Loader:" echo "*******************************" -# Receives passed values for É.. -# for example: -# espformat code is 1 for HFS, 2 for MSDOS, 0 for unknown +# Writes Chameleon stage 2 loader. +# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown +# Receives stage2Loader: Name of file - boot +# Receives selectedDestination: for example, /Volumes/USB +# Receives targetDevice: for example, /dev/disk3s1 +# Receives targetVolume: for example, /Volumes/USB +# Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 5 ]; then + +if [ "$#" -eq 6 ]; then espformat="$1" stage2Loader="$2" selectedDestination="$3" targetDevice="$4" targetVolume="$5" + scriptDir="$6" echo "DEBUG: passed argument for espformat = $espformat" echo "DEBUG: passed argument for stage2Loader = $stage2Loader" echo "DEBUG: passed argument for selectedDestination = $selectedDestination" echo "DEBUG: passed argument for targetDevice = $targetDevice" echo "DEBUG: passed argument for targetVolume = $targetVolume" + echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" exit 9 @@ -29,7 +36,6 @@ # if chosen, the package installer will add a file named 'nullESP' # in to the temporary directory /.Chameleon -#if [ -f "${selectedDestination}"/.Chameleon/nullESP ]; then if [ "${targetVolume}" = "/Volumes/EFI" ]; then echo "DEBUG: EFI install chosen" @@ -61,6 +67,7 @@ cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}" fi +"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${targetVolume}." #ÊCheck to see if the user wants to hide the boot file Index: branches/blackosx/package/Scripts/Install/CheckDiskMicrocode.sh =================================================================== --- branches/blackosx/package/Scripts/Install/CheckDiskMicrocode.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/CheckDiskMicrocode.sh (revision 1545) @@ -4,21 +4,28 @@ echo "CheckDiskMicrocode: Any existing bootloaders?" echo "*********************************************" -# This script is passed the targetDisk and diskSigCheck. -# -# it then reads the GPTdiskProtectiveMBR and searches for an existing +# Reads the GPTdiskProtectiveMBR and searches for an existing # Windows bootloader and also for an existing Chameleon stage 0 loader # which might be better changed depending on whether or not a Windows # signature is found or not. -# # The script then exits with the value 0 to indicate that Chameleon stage0 # loader can be written, or 1 to indicate not to write the stage0 loader. -if [ "$#" -eq 2 ]; then +# Receives targetDisk: for example, /dev/disk2. +# Receives diskSigCheck: 0 = Windows not installed / 1 = Windows installed. +# Receives targetVolume: Volume to install to. +# Receives scriptDir: The location of the main script dir. + + +if [ "$#" -eq 4 ]; then targetDisk="$1" diskSigCheck="$2" + targetVolume="$3" + scriptDir="$4" echo "DEBUG: passed argument for targetDisk = $targetDisk" echo "DEBUG: passed argument for diskSigCheck = $diskSigCheck" + echo "DEBUG: passed argument for targetVolume = $targetVolume" + echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed - Exiting" exit 9 @@ -47,17 +54,18 @@ # See if a Chameleon stage0 boot file already exists # Note: The checks for Boot0 and Boot0hfs assume the code stays the same. - # if the code changes then the hex values 0b807c and 0a803c used for matching + # if the code changes then the hex values 0b807c, 0a803c and ee7505 used for matching # need to be checked to see if they are the same or not. stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' ) - echo ${stage0type} + #echo ${stage0type} if [ "${stage0type}" == "0b807c" ]; then echo "Found existing Chameleon stage 0 loader - Boot0hfs" # Script CheckDiskSignature.sh returned 0 if a Windows installation was NOT found if [ "$diskSigCheck" == "0" ]; then echo "Found no existing Windows installation so will replace stage 0 loader with Boot0" + exit 0 fi fi @@ -67,15 +75,23 @@ # Script CheckDiskSignature.sh returned 1 if a Windows installation was found if [ "$diskSigCheck" = "1" ]; then echo "Found existing Windows installation so will replace stage 0 loader with Boot0hfs" + exit 0 fi fi - if [ "${stage0type}" != "0b807c" ] && [ "${stage0type}" != "0a803c" ] && [ "${windowsloader}" != "33c08ed0" ] ; then + if [ "${stage0type}" == "ee7505" ]; then + echo "Found existing Chameleon stage 0 loader - Boot0md" + echo "And will leave boot0md installed." + exit 1 + fi + + if [ "${stage0type}" != "0b807c" ] && [ "${stage0type}" != "0a803c" ] && [ "${stage0type}" != "ee7505" ] && [ "${windowsloader}" != "33c08ed0" ] ; then echo "Something other than Chameleon or a Windows bootloader was found" test=$(echo "${mbr437}" | awk -F0 '{print NF-1}' ) echo "Disk microcode found: ${test} - Preserving." echo "diskupdate is set to false" echo "-----------------------------------------------" + "$scriptDir"InstallLog.sh "${targetVolume}" "NOTE: Found existing unknown bootcode in the MBR" echo "" exit 1 fi Index: branches/blackosx/package/Scripts/Install/CheckProceed.sh =================================================================== --- branches/blackosx/package/Scripts/Install/CheckProceed.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/CheckProceed.sh (revision 1545) @@ -4,22 +4,21 @@ echo "Check Proceed: Can the script continue?" echo "***************************************" -# Checks the selected volume is present and the disk -# is partitioned. +# Checks the selected volume is present and the disk is partitioned. -# Receives targetVolumeTemp: Stores original target if EFI install selected. -# Receives targetVolume: Stores '/Volumes/EFI' if EFI install, or blank if not. -# Receives targetDevice: Stores device number: for example /dev/disk2s1. +# Receives targetVolume: Volume to install to (Will be '/Volumes/EFI' if EFI install) +# Receives targetDevice: Stores device number, for example /dev/disk2s1. +# Receives installerVolume: Volume to write the installer log to. # Receives scriptDir: The location of the main script dir. if [ "$#" -eq 4 ]; then - targetVolumeTemp="$1" - targetVolume="$2" - targetDevice="$3" + targetVolume="$1" + targetDevice="$2" + installerVolume="$3" scriptDir="$4" - echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp" echo "DEBUG: passed argument for targetVolume = $targetVolume" echo "DEBUG: passed argument for targetDevice = $targetDevice" + echo "DEBUG: passed argument for installerVolume = $installerVolume" echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" @@ -28,7 +27,7 @@ if [ -z "$targetVolume" ]; then echo "*** Cannot find the volume. Exiting." - "$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Cannot file the volume." + "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume." exit 1 else echo "Confirming target volume exists" @@ -36,7 +35,7 @@ if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then echo "*** ERROR Volume does not use slices. Exiting." - "$scriptDir"InstallLog.sh "${targetVolumeTemp}" "The selected volume doesn't use slices." + "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices." exit 1 else echo "Confirming target device uses slices" @@ -46,10 +45,10 @@ # 1GB USB flash drive which won't have an EFI System Partition. if [ "$targetVolume" = "/Volumes/EFI" ]; then - existESP=$( df | grep /dev/disk2s1 | awk {'print $6'} ) + existESP=$( df | grep $targetDevice | awk {'print $6'} ) if [ ! "$existESP" = "/Volumes/EFI" ]; then echo "*** The selected volume doesn't have an EFI System Partition. Exiting." - "$scriptDir"InstallLog.sh "${targetVolumeTemp}" "The selected volume doesn't have an EFI System Partition." + "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $installerVolume doesn't have an EFI System Partition." exit 1 fi fi Index: branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh =================================================================== --- branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh (revision 1545) @@ -8,16 +8,16 @@ # signature for either the GRUB or Linux bootloaders. # The script returns 1 if either is found, or 0 if none found. -# Receives targetdisk: Stores device number: for example /dev/disk2 -# Receives targetVolumeTemp: Stores original target if EFI install selected. +# Receives targetdisk: for example, /dev/disk2. +# Receives targetVolume: Volume to install to. # Receives scriptDir: The location of the main script dir. if [ "$#" -eq 3 ]; then targetDisk="$1" - targetVolumeTemp="$2" + targetVolume="$2" scriptDir="$3" echo "DEBUG: passed argument for targetDisk = $targetDisk" - echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp" + echo "DEBUG: passed argument for targetVolume = $targetVolume" echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" @@ -27,16 +27,16 @@ diskmicrocodetype[1]="GRUB,47525542" diskmicrocodetype[2]="LILO,4c494c4f" - diskmicrocode=$( dd 2>/dev/null if="$targetDisk" count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' ) #echo "${diskmicrocode}" diskmicrocodetypecounter=0 + while [ ${diskmicrocodetypecounter} -lt ${#diskmicrocodetype[@]} ]; do diskmicrocodetypecounter=$(( ${diskmicrocodetypecounter} + 1 )) diskmicrocodetypeid=${diskmicrocodetype[${diskmicrocodetypecounter}]#*,} if [ ! "${diskmicrocode}" = "${diskmicrocode/${diskmicrocodetypeid}/}" ]; then echo "${diskmicrocodetype[${diskmicrocodetypecounter}]%,*} found." - "$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Found an exisitng GRUB/LILO bootloader." + "$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Found an exisitng GRUB/LILO bootloader." exit 1 else echo "Didn't find a match for ${diskmicrocodetype[${diskmicrocodetypecounter}]%,*}" Index: branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh =================================================================== --- branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh (revision 1544) +++ branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh (revision 1545) @@ -4,10 +4,12 @@ echo "CheckWindowsDiskSignature: Is Windows installed?" echo "************************************************" -# this script is passed the targetdisk to work from, for example /dev/disk0 -# It then checks the disk sector for a 4-byte Windows disk signature +# Checks the disk sector for a 4-byte Windows disk signature # if one is found then it exits with 1, otherwise it exits with 0 +# Receives targetdisk: for example, /dev/disk0 + + if [ "$#" -eq 1 ]; then targetDisk="$1" echo "DEBUG: passed argument for targetDisk = $targetDisk" @@ -18,7 +20,7 @@ disksignature=$( dd 2>/dev/null if="$targetDisk" count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' ) -echo "${disksignature}" +#echo "${disksignature}" if [ "${disksignature}" = "00000000" ]; then echo "No Windows installation detected."