␊ |
# Initialise Script Globals␊ |
␊ |
stage0Loader="boot0" #diskloader␊ |
stage0LoaderDualBoot="boot0hfs" #was stage0Loaderdualboot␊ |
stage1LoaderHFS="boot1h" #was stage1LoaderHFS␊ |
stage1LoaderFAT="boot1f32" #was partitionloaderfat␊ |
stage2Loader="boot" #was filesystemloader␊ |
stage0Loader="boot0"␊ |
stage0LoaderDualBoot="boot0hfs"␊ |
stage1LoaderHFS="boot1h"␊ |
stage1LoaderFAT="boot1f32"␊ |
stage2Loader="boot"␊ |
␊ |
targetVolume=$3 #was bootvolume␊ |
targetDevice=$( df "${targetVolume}" | sed -n '2p' | awk '{print $1}' ) #was bootdev␊ |
targetDeviceRaw=${targetDevice/disk/rdisk} #was bootrdev␊ |
targetDisk=${targetDevice%s*} #was bootdisk␊ |
targetDiskRaw=${targetDisk/disk/rdisk} #was bootrdisk␊ |
targetSlice=${targetDevice#*disk*s} #was bootslice␊ |
targetResources="${targetVolume%/*}" #was bootresources - is this needed?␊ |
targetDevice=$( df "${targetVolume}" | sed -n '2p' | awk '{print $1}' )␊ |
targetDeviceRaw=${targetDevice/disk/rdisk}␊ |
targetDisk=${targetDevice%s*}␊ |
targetDiskRaw=${targetDisk/disk/rdisk}␊ |
targetSlice=${targetDevice#*disk*s}␊ |
␊ |
targetResources="${targetVolume%/*}" # is this needed?␊ |
␊ |
␊ |
echo "==============================================="␊ |
echo "DEBUG: display script variables"␊ |
echo "***************************"␊ |
␊ |
echo "DEBUG: stage0Loader: Disk loader is ${stage0Loader}"␊ |
echo "DEBUG: stage0LoaderDualBoot: Disk loader is ${stage0LoaderDualBoot}"␊ |
echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}"␊ |
echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}"␊ |
echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}"␊ |
echo "DEBUG: targetVolume: Volume is ${targetVolume}"␊ |
echo "DEBUG: targetDevice: Volume device is ${targetDevice}"␊ |
echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}"␊ |
echo "DEBUG: targetDisk: Disk device is ${targetDisk}"␊ |
echo "DEBUG: targetDiskRaw: Disk raw device is ${targetDiskRaw}"␊ |
echo "DEBUG: targetSlice: Volume slice is ${targetSlice}"␊ |
echo "DEBUG: targetResources: Boot Resources is ${targetResources}"␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
#echo "==============================================="␊ |
#echo "DEBUG: display script variables"␊ |
#echo "*******************************"␊ |
␊ |
#echo "DEBUG: stage0Loader: Disk loader is ${stage0Loader}"␊ |
#echo "DEBUG: stage0LoaderDualBoot: Disk loader is ${stage0LoaderDualBoot}"␊ |
#echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}"␊ |
#echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}"␊ |
#echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}"␊ |
#echo "DEBUG: targetVolume: Volume is ${targetVolume}"␊ |
#echo "DEBUG: targetDevice: Volume device is ${targetDevice}"␊ |
#echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}"␊ |
#echo "DEBUG: targetDisk: Disk device is ${targetDisk}"␊ |
#echo "DEBUG: targetDiskRaw: Disk raw device is ${targetDiskRaw}"␊ |
#echo "DEBUG: targetSlice: Volume slice is ${targetSlice}"␊ |
#echo "DEBUG: targetResources: Boot Resources is ${targetResources}"␊ |
#echo "-----------------------------------------------"␊ |
#echo ""␊ |
␊ |
␊ |
# 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}" "${targetDevice}"␊ |
returnValue=$?␊ |
if [ ${returnValue} = 0 ]; then␊ |
if [ ${returnValue}=0 ]; then␊ |
␉# OK to proceed␊ |
␊ |
␊ |
|
␊ |
␉␉if [ ${fatType} = 1 ] && [ ${partitionTable} = 3 ]; then␊ |
␉␉␉echo "ERROR: - Can't install to a device using FAT16"␊ |
␉␉␉# Write error to Chameleon_Error_Log file␊ |
␉␉␉"$scriptDir"WriteInstallerLog.sh "${3}" "${3} is a FAT16 device - Chameleon boot files not written"␊ |
␉␉else␊ |
␉␉␉# Continue if the selected device is not a FAT16 format device␊ |
␊ |
|
␉␉␉# Set the active partition ONLY if Windows is not installed␊ |
␉␉␉"$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}"␉␉␉␊ |
␉␉fi␊ |
␊ |
␉else␊ |
␉␉# Write error to Chameleon_Error_Log file␊ |
␉␉"$scriptDir"WriteInstallerLog.sh "${targetVolume}" "Error: Target drive has existing GRUB / Linux loader in the MBR - Not sure how to continue"␊ |
␉fi␊ |
else␊ |
␉# Write error to Chameleon_Error_Log file␊ |
␉"$scriptDir"WriteInstallerLog.sh "${targetVolume}" "Error: ${targetVolume} couldn't be found or the disk doesn't use slices"␊ |
fi␊ |
␊ |
exit 0␊ |