Index: branches/blackosx/package/Scripts/Main/Standard/postinstall =================================================================== --- branches/blackosx/package/Scripts/Main/Standard/postinstall (revision 1613) +++ branches/blackosx/package/Scripts/Main/Standard/postinstall (revision 1614) @@ -150,10 +150,10 @@ "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" if [ ${diskupdate} = "0" ]; then + # Write the stage 0 loader to the MBR "$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${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 Index: branches/blackosx/package/Scripts/Main/EFI/postinstall =================================================================== --- branches/blackosx/package/Scripts/Main/EFI/postinstall (revision 1613) +++ branches/blackosx/package/Scripts/Main/EFI/postinstall (revision 1614) @@ -151,12 +151,10 @@ "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak" 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}" "${targetResources}" "${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 Index: branches/blackosx/package/Scripts/Main/Post/postinstall =================================================================== --- branches/blackosx/package/Scripts/Main/Post/postinstall (revision 1613) +++ branches/blackosx/package/Scripts/Main/Post/postinstall (revision 1614) @@ -1,24 +1,17 @@ #!/bin/bash -# -# $1: the full path to the installation package; for example: -# /Volumes/Projects/Testing/Simple_Carbon_App.pkg -# -# $2: the full path to the installation destination; for example: -# /Applications -# -# $3: the mountpoint of the destination volume; for example: -# / or /Volumes/External_Drive -# -# $4: the root directory for the current System folder: -# / -echo "preinstall: Path to installer....... $1" -echo "preinstall: Path to destination..... $2" -echo "preinstall: Path to dest volume..... $3" -echo "preinstall: Root of system folder... $4" +echo "===============================================" +echo "Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" -#set -x # Useful for echoing everything the script does to the installer log!! +#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1 +#echo "DEBUG: $ 2 = Full path to the installation destination: " $2 +#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3 +#echo "DEBUG: $ 4 = Root directory for the system: " $4 +# Check target exists if [ ! -e "$3" ] then echo "$3 volume does not exist!" @@ -33,7 +26,7 @@ dest_vol="$3" fi -# Where are we, so to find the Install Log script. +# Find script location so to find the Install Log script. MYLOCATION="${PWD}/${BASH_ARGV[0]}" export MYLOCATION="${MYLOCATION%/*}" scriptDir=$MYLOCATION @@ -151,11 +144,10 @@ # Copy /usr/local/chamTemp/Extra to correct location. if [ -d "$chamTemp"/Extra ]; then - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then # The Standard install option chosen - # Does and /Extra folder already exist? + # Does an /Extra folder already exist? if [ -e "$dest_vol"/Extra ]; then "$scriptDir"InstallLog.sh "${dest_vol}" "Found existing $dest_vol/Extra folder. Renaming it $dest_vol/Extra-OLD-$( date "+%H-%M-%S" )" mv "$dest_vol/Extra" "$dest_vol/Extra_OLD-"$( date "+%H-%M-%S" ) @@ -164,7 +156,6 @@ cp -R "$chamTemp"/Extra "$dest_vol" else # The EFI system partition install option was chosen - # Does a /Volumes/Extra folder already exist? if [ -e "/Volumes/EFI/Extra" ]; then "$scriptDir"InstallLog.sh "${dest_vol}" "Found existing /Volumes/EFI/Extra folder. Renaming it Extra-OLD-$( date "+%H-%M-%S" )" @@ -172,17 +163,22 @@ fi "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: /Volumes/EFI/Extra" cp -R "$chamTemp"/Extra "/Volumes/EFI" - - # unmount /Volumes/EFI - attempts=1 - while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do - echo "Unmounting $( df | grep EFI | awk '{print $1}' )" - "$scriptDir"InstallLog.sh "${dest_vol}" "Unmounting $( df | grep EFI | awk '{print $1}' )" - umount -f $( df | grep EFI | awk '{print $1}' ) - attempts=$(( ${attempts} + 1 )) - done fi fi + + if [ -f "$dest_vol"/.ChameleonEFI ]; then + # unmount /Volumes/EFI + # Count of 5 exists incase for some reason /Volumes/EFI fails + # be unmounted in which case the loop would run forever. + attempts=1 + while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do + echo "Unmounting $( df | grep EFI | awk '{print $1}' )" + "$scriptDir"InstallLog.sh "${dest_vol}" "Find and unmount any volume named 'EFI':" + "$scriptDir"InstallLog.sh "${dest_vol}" "$( df | grep EFI | awk '{print $1}' )" + umount -f $( df | grep EFI | awk '{print $1}' ) + (( attempts++ )) + done + fi else echo "Removing /.ChameleonExists file" "$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup 4" @@ -220,4 +216,8 @@ rm "$dest_vol"/.ChameleonLogFlag fi -echo "Done..." \ No newline at end of file +echo "===============================================" +echo "END - Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" \ No newline at end of file Index: branches/blackosx/package/Scripts/Sub/WriteChameleonStage2.sh =================================================================== --- branches/blackosx/package/Scripts/Sub/WriteChameleonStage2.sh (revision 1613) +++ branches/blackosx/package/Scripts/Sub/WriteChameleonStage2.sh (revision 1614) @@ -8,9 +8,9 @@ # Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown # Receives stage2Loader: Name of file - boot -# Receives selectedDestination: for example, /Volumes/USB +# Receives selectedDestination: for example, /Volumes/ChameleonBootUSB (or /Volumes/EFI if ESP install). # Receives targetDevice: for example, /dev/disk3s1 -# Receives targetVolume: for example, /Volumes/USB +# Receives targetVolume: for example, /Volumes/ChameleonBootUSB # Receives scriptDir: The location of the main script dir. @@ -34,13 +34,13 @@ # check to see if install to EFI system partition was selected if [ "${selectedDestination}" = "/Volumes/EFI" ]; then - echo "DEBUG: EFI install chosen" + #echo "DEBUG: EFI install chosen" if [ ! -d "${selectedDestination}" ]; then echo "Executing Command: mkdir -p ${selectedDestination}" mkdir -p "${targetVolume}" - else - echo "DEBUG: folder /Volumes/EFI already exists" + #else + #echo "DEBUG: folder /Volumes/EFI already exists" fi #if the EFI system partition was selected then @@ -48,12 +48,14 @@ if [ ${espformat} = 1 ]; then - echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}" - mount_hfs "${targetDevice}" "${targetVolume}" + #echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}" + "$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}" + mount_hfs "${targetDevice}" "${selectedDestination}" fi if [ ${espformat} = 2 ]; then [ -d "${selectedDestination}" ] || mkdir -p "${selectedDestination}" - echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}" + #echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}" + "$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}" mount_msdos -u 0 -g 0 "${targetDevice}" "${selectedDestination}" fi Index: branches/blackosx/package/Scripts/Sub/UnMountEFIvolumes.sh =================================================================== --- branches/blackosx/package/Scripts/Sub/UnMountEFIvolumes.sh (revision 1613) +++ branches/blackosx/package/Scripts/Sub/UnMountEFIvolumes.sh (revision 1614) @@ -6,30 +6,33 @@ # loop through and un-mount ALL mounted 'EFI' system partitions - Thanks kizwan +# Receives targetVolumeChosenByUser: Stores original target if EFI install selected. # Receives scriptDir: The location of the main script dir. -# Receives targetVolumeTemp: Stores original target if EFI install selected. if [ "$#" -eq 2 ]; then - targetVolumeTemp="$1" + targetVolumeChosenByUser="$1" scriptDir="$2" - echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp" + echo "DEBUG: passed argument for targetVolumeChosenByUser = $targetVolumeChosenByUser" echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" exit 9 fi - +# Count of 5 exists incase for some reason /Volumes/EFI fails +# be unmounted in which case the loop would run forever. attempts=1 -while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do +while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do echo "Unmounting $( df | grep EFI | awk '{print $1}' )" + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Find and unmount any volume named 'EFI':" + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "$( df | grep EFI | awk '{print $1}' )" umount -f $( df | grep EFI | awk '{print $1}' ) - attempts=$(( ${attempts} + 1 )) + (( attempts++ )) done -if [ ${attempts} = 5 ]; then +if [ $attempts = 5 ]; then echo "failed to unmount 'EFI' System Partition." echo "-----------------------------------------------" - "$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Failed to unmount 'EFI' System Partition." + "$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition." echo "" echo "" echo ""