echo "CheckFatType: Do we have FAT16 or FAT32?"␊ |
echo "****************************************"␊ |
␊ |
# Receives passed value for the raw Target Device␊ |
# for example: /dev/rdisk0s2␊ |
# Then looks for the following in the partition boot sector␊ |
# Looks for the following in the partition boot sector␊ |
# Byte number 19 to see if it's either 00 or 02␊ |
# Byte number 22 to see if it's either F8 or F0␊ |
# Byte number 25 to see if it's either 3F or 20␊ |
|
# Exit with value 1 for FAT16, 2 for FAT32 ␊ |
# Exit with value 0 if nothing is found - this shouldn't happen.?␊ |
␊ |
if [ "$#" -eq 1 ]; then␊ |
# Receives targetDeviceRaw: for example, /dev/rdisk0s2.␊ |
# Receives targetVolume: Volume to install to.␊ |
# Receives scriptDir: The location of the main script dir.␊ |
␊ |
␊ |
if [ "$#" -eq 3 ]; then␊ |
␉targetDeviceRaw="$1"␊ |
␉targetVolume="$2"␊ |
␉scriptDir="$3"␊ |
␉echo "DEBUG: passed argument = $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␊ |
|
␉echo "Found a FAT32 device formatted by Windows Explorer"␊ |
␉echo "--------------------------------------------------"␊ |
␉echo ""␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT32 volume formatted by Windows Explorer"␊ |
␉exit 2␊ |
fi␊ |
if [ "${partitionBootSector:36:2}" == "02" ] && [ "${partitionBootSector:42:2}" == "f8" ] && [ "${partitionBootSector:48:2}" == "3f" ]; then␊ |
␉echo "Found a FAT16 device formatted by Windows Explorer"␊ |
␉echo "--------------------------------------------------"␊ |
␉echo ""␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT16 volume formatted by Windows Explorer"␊ |
␉exit 1␊ |
fi␊ |
if [ "${partitionBootSector:36:2}" == "00" ] && [ "${partitionBootSector:42:2}" == "f0" ] && [ "${partitionBootSector:48:2}" == "20" ]; then␊ |
␉echo "Found a FAT32 device formatted by OS X Snow Leopard Disk Utility"␊ |
␉echo "----------------------------------------------------------------"␊ |
␉echo ""␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT32 volume formatted by OS X Snow Leopard Disk Utility"␊ |
␉exit 2␊ |
fi␊ |
if [ "${partitionBootSector:36:2}" == "02" ] && [ "${partitionBootSector:42:2}" == "f0" ] && [ "${partitionBootSector:48:2}" == "20" ]; then␊ |
␉echo "Found a FAT16 device formatted by OS X Snow Leopard Disk Utility"␊ |
␉echo "----------------------------------------------------------------"␊ |
␉echo ""␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT16 volume formatted by OS X Snow Leopard Disk Utility"␊ |
␉exit 1␊ |
fi␊ |
if [ "${partitionBootSector:36:2}" == "00" ] && [ "${partitionBootSector:42:2}" == "f8" ] && [ "${partitionBootSector:48:2}" == "20" ]; then␊ |
␉echo "Found a FAT32 device formatted by OS X Lion Disk Utility"␊ |
␉echo "--------------------------------------------------------"␊ |
␉echo ""␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT32 volume formatted by OS X Lion Disk Utility"␊ |
␉exit 2␊ |
fi␊ |
if [ "${partitionBootSector:36:2}" == "02" ] && [ "${partitionBootSector:42:2}" == "f8" ] && [ "${partitionBootSector:48:2}" == "20" ]; then␊ |
␉echo "Found a FAT16 device formatted by OS X Lion Disk Utility"␊ |
␉echo "--------------------------------------------------------"␊ |
␉echo ""␊ |
␉"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT16 volume formatted by OS X Lion Disk Utility"␊ |
␉exit 1␊ |
fi␊ |
echo "-----------------------------------------------"␊ |