echo "Set Active Partition ONLY if Windows is not installed"␊ |
echo "*****************************************************"␊ |
␊ |
|
# for example: ␊ |
# efiformat code is 1 for HFS, 2 for MSDOS, 0 for unknown␊ |
# diskSigCheck code is 1 for a Windows install, 0 for no Windows install␊ |
# Sets partition active if Windows is not installed.␊ |
␊ |
# Receives efiformat: code is 1 for HFS, 2 for MSDOS, 0 for unknown␊ |
# Receives diskSigCheck: code is 1 for a Windows install, 0 for no Windows install␊ |
# Receives targetDiskRaw: for example, /dev/rdisk1␊ |
# Receives targetSlice: for example, 1␊ |
# Receives targetVolume: Volume to install to.␊ |
# Receives scriptDir: The location of the main script dir.␊ |
␊ |
if [ "$#" -eq 6 ]; then␊ |
␉efiformat="$1"␊ |
␉diskSigCheck="$2"␊ |
|
␉exit 9␊ |
fi␊ |
␊ |
partitionactive=$( fdisk -d ${targetDiskRaw} | grep -n "*" | awk -F: '{print $1}')␊ |
"$scriptDir"InstallLog.sh "${targetVolume}" "Current active partition on ${targetDiskRaw#/dev/r}: ${partitionactive}"␊ |
␊ |
if [ ${diskSigCheck} == "0" ]; then␊ |
␉echo "DEBUG: Windows is not installed so let's change the active partition"␊ |
␉#echo "DEBUG: Windows is not installed so let's change the active partition"␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "Windows is not installed so let's change the active partition"␊ |
␊ |
␉partitionactive=$( "${scriptDir}"/Tools/fdisk440 -d ${targetDiskRaw} | grep -n "*" | awk -F: '{print $1}')␊ |
␉echo "Current Active Partition: ${partitionactive}"␊ |
␊ |
␉if [ "${partitionactive}" = "${targetSlice}" ]; then␊ |
␉␉echo "${targetVolume} is already flagged as active"␊ |
␉␉#echo "${targetVolume} is already flagged as active"␊ |
␉␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetVolume} is already flagged as active"␊ |
␉else␊ |
␉␉echo "${targetVolume} is not flagged as active, so let's do it."␊ |
␉␉#echo "${targetVolume} is not flagged as active, so let's do it."␊ |
␉␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetVolume} is not flagged as active, so let's do it."␊ |
␉␉# BadAxe requires EFI partition to be flagged active.␊ |
␉␉# but it doesn't' hurt to do it for any non-windows partition.␊ |
␉␉␊ |
␉␉"${scriptDir}"/Tools/fdisk440 -e ${targetDiskRaw} <<-MAKEACTIVE␊ |
␉␉fdisk -e ${targetDiskRaw} <<-MAKEACTIVE␊ |
␉␉print␊ |
␉␉flag ${targetSlice}␊ |
␉␉write␊ |
|
␉␉MAKEACTIVE␊ |
␉fi␊ |
else␊ |
␉echo "Windows is installed so we let that remain the active partition"␊ |
␉#echo "Windows is installed so we let that remain the active partition"␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "Windows is installed so that can remain the active partition"␊ |
fi␊ |
␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
␊ |
exit 0␊ |
␊ |
␊ |
␊ |
exit 0 |