Index: branches/blackosx/package/Scripts/Main/Standard/postinstall =================================================================== --- branches/blackosx/package/Scripts/Main/Standard/postinstall (revision 1607) +++ branches/blackosx/package/Scripts/Main/Standard/postinstall (revision 1608) @@ -170,6 +170,8 @@ "$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}" "${scriptDir}" fi fi +else + echo "Stop" >"${targetVolume}"/.ChameleonExists fi "$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak" Index: branches/blackosx/package/Scripts/Main/EFI/postinstall =================================================================== --- branches/blackosx/package/Scripts/Main/EFI/postinstall (revision 1607) +++ branches/blackosx/package/Scripts/Main/EFI/postinstall (revision 1608) @@ -92,7 +92,7 @@ # Now also check for another existing Chameleon installation on the same disk. # If the following script finds anything, it returns 1 to indicate failure. - "$scriptDir"CheckProceed.sh "${targetDisk}" "${targetDeviceRaw}" "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" + "$scriptDir"CheckProceed.sh "${targetDisk}" "${targetDeviceRaw}" "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" returnValue=$? if [ ${returnValue} = 0 ]; then # OK to proceed @@ -173,6 +173,8 @@ "$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeChosenByUser}" "${scriptDir}" fi fi + else + echo "Stop" >"${targetVolumeChosenByUser}"/.ChameleonExists fi else #echo "ERROR Volume is not on a GPT partitioned disc." Index: branches/blackosx/package/Scripts/Main/Post/postinstall =================================================================== --- branches/blackosx/package/Scripts/Main/Post/postinstall (revision 1607) +++ branches/blackosx/package/Scripts/Main/Post/postinstall (revision 1608) @@ -53,136 +53,140 @@ # set temporary directory chamTemp="$dest_vol/usr/local/chamTemp" -# Check for temporary directory/Extra folder. -#if [ ! -d "$chamTemp"/Extra ]; then -# mkdir "$chamTemp"/Extra -#fi +# Check for stopped installation due to Chameleon +# already existing on the same disk. +if [ ! -f "$dest_vol"/.ChameleonExists ]; then -# --------------------------------------------- -# Add any installed modules to the Install Log -# --------------------------------------------- -if [ -e "${chamTemp}"/Extra/modules ]; then - ls "${chamTemp}"/Extra/modules | while read FILE - do - "$scriptDir"InstallLog.sh "${dest_vol}" "Installed module:$FILE" - done -fi + # --------------------------------------------- + # Add any installed modules to the Install Log + # --------------------------------------------- + if [ -e "${chamTemp}"/Extra/modules ]; then + ls "${chamTemp}"/Extra/modules | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Installed module:$FILE" + done + fi -# --------------------------------------------- -# Add any installed themes to the Install Log -# --------------------------------------------- -if [ -e "${chamTemp}"/Extra/Themes ]; then - ls "${chamTemp}"/Extra/Themes | while read FILE - do - "$scriptDir"InstallLog.sh "${dest_vol}" "Installed Theme:$FILE" - done -fi + # --------------------------------------------- + # Add any installed themes to the Install Log + # --------------------------------------------- + if [ -e "${chamTemp}"/Extra/Themes ]; then + ls "${chamTemp}"/Extra/Themes | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Installed Theme:$FILE" + done + fi -# --------------------------------------------- -# Build org.chameleon.Boot.plist -# --------------------------------------------- -# All options selected are now dummy files with -# the filename of the option and value residing -# in /usr/local/chamTemp/options/ -# for example. Boot Banner=Yes + # --------------------------------------------- + # Build org.chameleon.Boot.plist + # --------------------------------------------- + # All options selected are now dummy files with + # the filename of the option and value residing + # in /usr/local/chamTemp/options/ + # for example. Boot Banner=Yes -# Are there any options to build? -if [ "$(ls -A ${chamTemp}/options )" ]; then + # Are there any options to build? + if [ "$(ls -A ${chamTemp}/options )" ]; then - # Check for temporary directory/Extra folder. - if [ ! -d "$chamTemp"/Extra ]; then - mkdir "$chamTemp"/Extra - fi + # Check for temporary directory/Extra folder. + if [ ! -d "$chamTemp"/Extra ]; then + mkdir "$chamTemp"/Extra + fi - # Create template for org.chameleon.Boot.plist" - tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" + # Create template for org.chameleon.Boot.plist" + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" - # Read list of all boot options the user added. - arrayCount=0 - kernelFlagCount=0 - while read FILE - do - options[arrayCount]="${FILE##*/}" + # Read list of all boot options the user added. + arrayCount=0 + kernelFlagCount=0 + while read FILE + do + options[arrayCount]="${FILE##*/}" - # Check keyRead for 'KF' at beginning to - # indicate that should be a kernel flag - if [ ${options[arrayCount]:0:2} = "KF" ];then - # plistbuddy only add's if the key doesn't already exist. - #ĘSo let's store any kernelflags and add them all at the - # same time once when we reach the end of the options list. - kernelflag[kernelFlagCount]="${options[arrayCount]##*flag=}" - "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: ${kernelflag[kernelFlagCount]}" - (( kernelFlagCount++ )) - else - keyRead="${options[$arrayCount]%=*}" - value="${options[$arrayCount]#*=}" - # escape any spaces - keyToUse=$( echo $keyRead | sed 's/ /\\ /g' ) - if [ "${keyToUse}" != "DONT" ] && [ "${value}" != "USE" ]; then - sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" - "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${keyRead}=${value}" - fi - fi - (( arrayCount++ )) - done < <(ls "${chamTemp}"/options ) + # Check keyRead for 'KF' at beginning to + # indicate that should be a kernel flag + if [ ${options[arrayCount]:0:2} = "KF" ];then + # plistbuddy only add's if the key doesn't already exist. + # So let's store any kernelflags and add them all at the + # same time once when we reach the end of the options list. + kernelflag[kernelFlagCount]="${options[arrayCount]##*flag=}" + "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: ${kernelflag[kernelFlagCount]}" + (( kernelFlagCount++ )) + else + keyRead="${options[$arrayCount]%=*}" + value="${options[$arrayCount]#*=}" + # escape any spaces + keyToUse=$( echo $keyRead | sed 's/ /\\ /g' ) + if [ "${keyToUse}" != "DONT" ] && [ "${value}" != "USE" ]; then + sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" + "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${keyRead}=${value}" + fi + fi + (( arrayCount++ )) + done < <(ls "${chamTemp}"/options ) - if [ $kernelFlagCount -gt 0 ]; then - # Add kernel flags - for (( i=0 ; i < $kernelFlagCount ; i++ )) - do - # Add any kernel flags together in to one string. - kernelFlagString="${kernelFlagString} ${kernelflag[i]}" - done - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" - if [ ${returnValue}=1 ]; then # key already exists. - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" - fi - fi -fi + if [ $kernelFlagCount -gt 0 ]; then + # Add kernel flags + for (( i=0 ; i < $kernelFlagCount ; i++ )) + do + # Add any kernel flags together in to one string. + kernelFlagString="${kernelFlagString} ${kernelflag[i]}" + done + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + if [ ${returnValue}=1 ]; then # key already exists. + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + fi + fi + fi -# --------------------------------------------- -# Copy temp Extra folder to target destination -# --------------------------------------------- -# If we've made a temporary Extra folder to use then -# check for an existing /Extra folder. If found, back it up -# before copying the temporary Extra folder to destination. -# Extra folder now resides in /usr/local/chamTemp/ -# Copy /usr/local/chamTemp/Extra to correct location. + # --------------------------------------------- + # Copy temp Extra folder to target destination + # --------------------------------------------- + # If we've made a temporary Extra folder to use then + # check for an existing /Extra folder. If found, back it up + # before copying the temporary Extra folder to destination. + # Extra folder now resides in /usr/local/chamTemp/ + # Copy /usr/local/chamTemp/Extra to correct location. -if [ -d "$chamTemp"/Extra ]; then + if [ -d "$chamTemp"/Extra ]; then - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then - # The Standard install option chosen + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + # The Standard install option chosen - # Does and /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" ) - fi - "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: $dest_vol/Extra" - cp -R "$chamTemp"/Extra "$dest_vol" - else - # The EFI system partition install option was chosen + # Does and /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" ) + fi + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: $dest_vol/Extra" + 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" )" - mv "/Volumes/EFI/Extra" "/Volumes/EFI/Extra_OLD-"$( date "+%H-%M-%S" ) - fi - "$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: /Volumes/EFI/Extra" - cp -R "$chamTemp"/Extra "/Volumes/EFI" + # 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" )" + mv "/Volumes/EFI/Extra" "/Volumes/EFI/Extra_OLD-"$( date "+%H-%M-%S" ) + 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 + # 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 +else + echo "Removing /.ChameleonExists file" + "$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup 4" + rm "$dest_vol"/.ChameleonExists fi # ---------------------------------------------