#!/bin/bash␊ |
␊ |
diskloader="/usr/standalone/i386/boot0"␊ |
partitionloader="/usr/standalone/i386/boot1h"␊ |
filesystemloader="/usr/standalone/i386/boot"␊ |
␊ |
diskloader="boot0"␊ |
diskloaderdualboot="boot0hfs"␊ |
partitionloaderhfs="boot1h"␊ |
partitionloaderfat="boot1f32"␊ |
filesystemloader="boot"␊ |
bootervolumename="EFI"␊ |
booterextensions="Extra/Extensions"␊ |
␊ |
bootresources="${0%/*}"␊ |
␊ |
diskmicrocodetype[1]="GRUB,47525542"␊ |
diskmicrocodetype[2]="LILO,4c494c4f"␊ |
␊ |
start ()␊ |
{␊ |
# $1 volume␊ |
# 1 volume␊ |
␊ |
osxvolume="${@}"␊ |
bootresources="${0%/*}"␊ |
echo "$bootresources"␊ |
␊ |
if [ -z "${osxvolume}" ]; then␊ |
␉echo␊ |
␉echo "Cannot find the volume. Exiting."␊ |
␉echo␊ |
␉exit␊ |
fi␊ |
␊ |
bootdev=$( df "${osxvolume}" | sed -n '2p' | awk '{print $1}' )␊ |
osxbootdev=$( df "${osxvolume}" | sed -n '2p' | awk '{print $1}' )␊ |
␊ |
if [ "${bootdev}" = "${bootdev#*disk*s}" ]; then␊ |
if [ "${osxbootdev}" = "${osxbootdev#*disk*s}" ]; then␊ |
␉echo␊ |
␉echo "ERROR Volume does not use slices."␊ |
␉echo "Volume may be stored on a RAID array."␊ |
␉echo␊ |
␉exit␊ |
␉exit␉␉␉␉␊ |
fi␊ |
␊ |
partitiontable=$( dd 2>/dev/null if=${bootdev%s*} count=1 skip=1 | dd 2>/dev/null count=8 bs=1 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
if [ "${partitiontable:0:16}" == "4546492050415254" ]; then␉␊ |
␉partitiontable=$( dd 2>/dev/null if=${bootdev%s*} count=1 | dd 2>/dev/null count=64 bs=1 skip=446 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
␉if [ "${partitiontable:8:2}" == "ee" ]; then␊ |
␉␉if [ "${partitiontable:40:2}" == "00" ] && [ "${partitiontable:72:2}" == "00" ] && [ "${partitiontable:104:2}" == "00" ]; then␊ |
␉␉␉partitiontable="GPT"␊ |
␉ ␉else␊ |
␉␉␉partitiontable="GPT/MBR"␊ |
␉␉fi␊ |
␉fi␊ |
else␊ |
␉echo␊ |
␉echo "ERROR Volume is not on a GPT partitioned disc."␊ |
␉echo␊ |
␉exit␊ |
fi␊ |
␊ |
echo "${partitiontable} found."␊ |
␊ |
echo "OS X Volume is ${osxvolume}"␊ |
echo "OX X Volume device is ${bootdev}"␊ |
␊ |
bootvolume="/Volumes/$bootervolumename"␊ |
bootdev=${bootdev%s*}s1␊ |
bootdev=${osxbootdev%s*}s1␊ |
bootrdev=${bootdev/disk/rdisk}␊ |
bootdisk=${bootdev%s*}␊ |
bootrdisk=${bootdisk/disk/rdisk}␊ |
bootslice=${bootdev#*disk*s}␊ |
␊ |
echo "EFI Volume device is ${bootdev}"␊ |
echo "EFI Volume raw device is ${bootrdev}"␊ |
echo "EFI Volume slice is ${bootslice}"␊ |
echo "Disk device is ${bootdisk}"␊ |
echo "Disk raw device is ${bootrdisk}"␊ |
echo "Disk loader is ${diskloader}"␊ |
echo "Partition loader is ${partitionloader}"␊ |
echo "Filesystem loader is ${filesystemloader}"␊ |
␊ |
echo "==============================================="␊ |
echo "Installer Variables:"␊ |
echo "********************"␊ |
echo "OS X Volume is ${osxvolume}"␊ |
echo "OX X Volume device is ${osxbootdev}"␊ |
echo "bootdev: EFI Volume device is ${bootdev}"␊ |
echo "bootrdev: EFI Volume raw device is ${bootrdev}"␊ |
echo "bootslice: EFI Volume slice is ${bootslice}"␊ |
echo "bootdisk: Disk device is ${bootdisk}"␊ |
echo "bootrdisk: Disk raw device is ${bootrdisk}"␊ |
echo "diskloader: Disk loader is ${diskloader}"␊ |
echo "diskloaderdualboot: Disk loader is ${diskloaderdualboot}"␊ |
echo "partitionloaderhfs: Partition loader is ${partitionloaderhfs}"␊ |
echo "partitionloaderfat: Partition loader is ${partitionloaderfat}"␊ |
echo "filesystemloader: Filesystem loader is ${filesystemloader}"␊ |
echo "bootresources: Boot Resources is ${bootresources}"␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
}␊ |
␊ |
checkdiskmicrocodetype ()␊ |
{␊ |
echo "==============================================="␊ |
echo "Diskmicrocodetype: CHECKED FOR EFI"␊ |
echo "******************"␊ |
␊ |
diskmicrocode=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
␊ |
diskmicrocodetypecounter=0␊ |
while [ ${diskmicrocodetypecounter} -lt ${#diskmicrocodetype[@]} ]; do␊ |
diskmicrocodetypecounter=$(( ${diskmicrocodetypecounter} + 1 ))␊ |
diskmicrocodetypeid=${diskmicrocodetype[${diskmicrocodetypecounter}]#*,}␊ |
if [ ! "${diskmicrocode}" = "${diskmicrocode/${diskmicrocodetypeid}/}" ]; then␊ |
echo "${diskmicrocodetype[${diskmicrocodetypecounter}]%,*} found."␊ |
␉else␊ |
␉␉echo "Didn't find a match for ${diskmicrocodetype[${diskmicrocodetypecounter}]%,*}"␊ |
fi␊ |
done␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
}␊ |
␊ |
checkdiskmicrocode ()␊ |
{␊ |
echo "==============================================="␊ |
echo "Diskmicrocode: CHECKED FOR EFI"␊ |
echo "*************"␊ |
␊ |
# Note: The checks for Boot0 and Boot0hfs assume the code doesn't change!!␊ |
␊ |
# 1 action ( check or set )␊ |
␊ |
diskmicrocode=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
diskmicrocodemd5=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | md5 )␊ |
␊ |
#echo "${diskmicrocode}"␊ |
␊ |
if [ $( echo "${diskmicrocode}" | awk -F0 '{print NF-1}' ) = 874 ]; then␊ |
␉echo "Diskmicrocode = 874 (Which means the first 437 bytes of the MBR Disk Sector is blank)"␊ |
␉if [ "${1}" = "set" ]; then␊ |
␉␉echo "No disk microcode found. Updating."␊ |
␉␉diskupdate=true␊ |
␉␉echo "diskupdate is now set to true."␊ |
␉else␊ |
␉␉echo "No disk microcode found."␊ |
␉fi␊ |
else␊ |
␉# There is already something on the MBR ␊ |
␉if [ ${1} = set ]; then␊ |
␉␉echo "Disk microcode found. Preserving."␊ |
␊ |
␉␉# See if a Windows bootloader already exists␊ |
␉␉windowsloader=$( dd 2>/dev/null if=${bootdisk} count=4 bs=1 | xxd | awk '{print $2$3}' )␊ |
␉␉if [ "${windowsloader}" == "33c08ed0" ] ; then␊ |
␉␉␉echo "Found existing Windows Boot Loader"␊ |
␉␉␉echo "Will replace loader with Boot0hfs"␊ |
␉␉␉diskupdate=true␊ |
␉␉␉echo "diskupdate is now set to true."␊ |
␉␉fi␊ |
␊ |
␉␉# See if a Chameleon stage0 boot file already exists␊ |
␉␉stage0type=$( dd 2>/dev/null if=${bootdisk} count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' )␊ |
␉␉if [ "${stage0type}" == "0b807c" ] || [ "${stage0type}" == "0a803c" ] ; then␊ |
␊ |
␉␉␉echo "Found existing Chameleon Stage 0 Loader"␊ |
␉␉␉# if found Boot0HFS without a Windows installation set diskupdate to true␊ |
␉␉␉if [ "${stage0type}" == "0b807c" ] && [ "${disksignature}" == "00000000" ]; then␊ |
␉␉␉␉echo "Found existing Chameleon Boot0HFS without a Windows installation"␊ |
␉␉␉␉echo "Will replace loader with Boot0"␊ |
␉␉␉␉diskupdate=true␊ |
␉␉␉␉echo "diskupdate is now set to true."␊ |
␉␉␉fi␊ |
␊ |
␉␉␉# if found Boot0 with a Windows installation set diskupdate to true␊ |
␉␉␉if [ "${stage0type}" == "0a803c" ] && [ "${disksignature}" != "00000000" ]; then␊ |
␉␉␉␉echo "Found existing Chameleon Boot0 with a Windows installation"␊ |
␉␉␉␉echo "Will replace loader with Boot0hfs"␊ |
␉␉␉␉diskupdate=true␊ |
␉␉␉␉echo "diskupdate is now set to true."␊ |
␉␉␉fi␊ |
␉␉fi␊ |
␊ |
␉␉# If neither a Windows or Chameleon Boot Loader exists␊ |
␉␉if [ "${stage0type}" != "0b807c" ] && [ "${stage0type}" != "0a803c" ] && [ "${windowsloader}" != "33c08ed0" ] ; then␊ |
␉␉␉test=$(echo "${diskmicrocode}" | awk -F0 '{print NF-1}' )␊ |
␉␉␉echo "Disk microcode found: ${test} - Preserving."␊ |
␉␉␉echo "diskupdate is left at false"␊ |
␉␉fi␊ |
␉else␊ |
␉␉echo "Disk microcode found."␊ |
␉␉test=$(echo "${diskmicrocode}" | awk -F0 '{print NF-1}' )␊ |
␉␉echo "Disk microcode found: ${test}"␊ |
␉fi␊ |
␉echo "Disk microcode MD5 is ${diskmicrocodemd5}"␊ |
fi␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
}␊ |
␊ |
␊ |
checkdisksignature ()␊ |
{␊ |
echo "==============================================="␊ |
echo "Find Disk Signature: CHECKED FOR EFI"␊ |
echo "*************"␊ |
␊ |
disksignature=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
␊ |
if [ $( echo "${disksignature}" | awk -F0 '{print NF-1}' ) = 8 ]; then␊ |
␉echo "No disk signature found."␊ |
echo "${disksignature}"␊ |
␊ |
if [ $disksignature = "00000000" ]; then␊ |
␉echo "Just Zero's found meaning Windows isn't installed."␊ |
else␊ |
␉echo "Disk signature found."␊ |
␉echo "Disk signature is 0x${disksignature}"␊ |
␉echo "Non Zero means we've found a Windows installation"␊ |
fi␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
}␊ |
␊ |
␊ |
␊ |
checkpartitionbootcode ()␊ |
{␊ |
echo "==============================================="␊ |
echo "Find Partition Bootcode: CHECKED FOR EFI"␊ |
echo "************************"␊ |
␊ |
# 1 action ( check or set )␊ |
␊ |
partitionbootcode=$( dd if=${bootrdev} count=1 2>/dev/null | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
partitionbootcodeextended=$( dd if=${bootrdev} count=1 skip=1 2>/dev/null | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
␊ |
echo "${partitionbootcode}"␊ |
␊ |
if [ $( echo "${partitionbootcode}" | awk -F0 '{print NF-1}' ) = 1024 ]; then␊ |
␉echo "partitionbootcode = 1024 (Which means the whole 512 bytes of the MBR Disk Sector is blank)"␊ |
␉if [ "${1}" = "set" ]; then␊ |
␉␉echo "No partition bootcode found. Updating."␊ |
␉else␊ |
|
␉fi␊ |
␉echo "Partition bootcode MD5 is ${partitionbootcodemd5}"␊ |
fi␊ |
␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
}␊ |
␊ |
checkpartitionactive ()␊ |
{␊ |
partitionactive=$( fdisk440 -d ${bootrdisk} | grep -n "*" | awk -F: '{print $1}')␊ |
␊ |
if [ -n "${partitionactive}" ]; then ␊ |
␉echo "Partition flagged active is ${partitionactive}"␊ |
start ${3}␊ |
␊ |
␊ |
echo "==============================================="␊ |
echo "Check the format of the EFI partition"␊ |
echo "***************************"␊ |
if [ "$( df | grep ${bootdev} )" ]; then␊ |
␉echo "EFI partition is currently mounted, so un-mounting it"␊ |
#␉umount -f ${bootdev}␊ |
else␊ |
␉echo "No partition flagged active."␊ |
␉echo "EFI partition is currently not mounted"␊ |
fi ␊ |
␊ |
if [ "$( fstyp ${bootdev} | grep hfs )" ]; then␊ |
␉echo "${bootdev} is a currently formatted as HFS"␊ |
␉efiformat="hfs"␊ |
fi␊ |
if [ "$( fstyp ${bootdev} | grep msdos )" ]; then␊ |
␉echo "${bootdev} is currently formatted as msdos"␊ |
␉efiformat="msdos"␊ |
#␉echo "Executing command: newfs_hfs -v ${bootervolumename} ${bootdev}"␊ |
#␉newfs_hfs -v "${bootervolumename}" "${bootdev}"␊ |
fi␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
␊ |
}␊ |
␊ |
start ${3}␊ |
␊ |
if [ "$( df | grep ${bootdev} )" ]; then␊ |
␉umount -f ${bootdev}␊ |
fi ␊ |
␊ |
if ! [ "$( fstyp ${bootdev} | grep hfs )" ]; then␊ |
␉echo "${bootdev} isn't a HFS partition"␊ |
␉echo "Executing command: newfs_hfs -v ${bootervolumename} ${bootdev}"␊ |
␉newfs_hfs -v "${bootervolumename}" "${bootdev}"␊ |
echo "==============================================="␊ |
echo "Determine Partition Scheme: CHANGED FOR EFI"␊ |
echo "***************************"␊ |
␊ |
partitiontable=$( dd 2>/dev/null if=${bootdisk} count=1 skip=1 | dd 2>/dev/null count=8 bs=1 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
if [ "${partitiontable:0:16}" == "4546492050415254" ]; then␉␊ |
␉partitiontable=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=64 bs=1 skip=446 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )␊ |
␉if [ "${partitiontable:8:2}" == "ee" ]; then␊ |
␉␉echo "Found System ID 'EE' to identify GPT Partition"␊ |
␉␉if [ "${partitiontable:40:2}" == "00" ] && [ "${partitiontable:72:2}" == "00" ] && [ "${partitiontable:104:2}" == "00" ]; then␊ |
␉␉␉echo "Found System ID '00' for each remaining possible partition"␊ |
␉␉␉partitiontable="GPT"␊ |
␉ ␉else␊ |
␉␉␉partitiontable="GPT/MBR"␊ |
␉␉fi␊ |
␉fi␊ |
else␊ |
␉echo "${bootdev} is already a HFS partition (skipping)"␊ |
␉echo "ERROR Volume is not on a GPT partitioned disc."␊ |
␉exit␊ |
fi␊ |
␊ |
echo "${partitiontable} found."␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
␊ |
␊ |
diskupdate=false␊ |
␊ |
␊ |
checkdisksignature␊ |
checkdiskmicrocodetype␊ |
checkdiskmicrocode set␊ |
checkdisksignature␊ |
checkpartitionbootcode set␊ |
checkpartitionactive␊ |
␊ |
␊ |
␊ |
echo "==============================================="␊ |
echo "Can we install the Chameleon bootloader files? : CHECKED FOR EFI"␊ |
echo "**********************************************"␊ |
␊ |
if ${diskupdate}; then␊ |
␉echo "Executing command: fdisk440 -u -f ${diskloader} -y ${bootdisk}"␊ |
␉fdisk440 -u -f "${osxvolume}/${diskloader}" -y ${bootdisk}␊ |
␉echo "Diskupdate = true, so yes"␊ |
␉#---------------------------------------------------------------------␊ |
␉# Check bytes 438-446 of the GPTdiskProtectiveMBR for a Windows Disk Signature␊ |
|
␉#---------------------------------------------------------------------␊ |
␊ |
␉if [ ${disksignature} == "00000000" ]; then␊ |
␉␉echo "Executing command: fdisk440 -u -f /usr/standalone/i386/${diskloader} -y ${bootdisk}"␊ |
␉␉fdisk440 -u -f "${bootvolume}/usr/standalone/i386/${diskloader}" -y ${bootdisk}␊ |
␉else␊ |
␉␉#---------------------------------------------------------------------␊ |
␉␉# If it exists then Windows is also installed on the HDD and we need to write boot0hfs␊ |
␉␉#---------------------------------------------------------------------␊ |
␉␉echo "Executing command: fdisk440 -u -f /usr/standalone/i386/${diskloaderdualboot} -y ${bootdisk}"␊ |
␉␉fdisk440 -u -f "${bootvolume}/usr/standalone/i386/${diskloaderdualboot}" -y ${bootdisk}␊ |
␉fi␊ |
else␊ |
echo "Diskupdate is false, so no stage 0 file was written"␊ |
fi␊ |
␊ |
echo "Executing command: dd if=${partitionloader} of=${bootrdev}"␊ |
dd if="${osxvolume}/${partitionloader}" of=${bootrdev}␊ |
if [ ${efiformat} = "hfs" ]; then␊ |
␉echo "Executing command: dd if=/usr/standalone/i386/${partitionloaderhfs} of=${bootrdev}"␊ |
␉dd if="${bootvolume}/usr/standalone/i386/${partitionloaderhfs}" of=${bootrdev}␊ |
fi␊ |
if [ ${efiformat} = "msdos" ]; then␊ |
␉echo "Executing command: dd if=/usr/standalone/i386/${partitionloaderfat} of=${bootrdev}"␊ |
␉dd if="${bootvolume}/usr/standalone/i386/${partitionloaderfat}" of=${bootrdev}␊ |
fi␊ |
␊ |
# If table is GPT make the first partition active (BadAxe compatibility).␊ |
[ "${partitiontable}" = "GPT" ] && bootslice=1␊ |
if [[ "${partitiontable}" = "GPT" ]]; then␊ |
␉fdisk440 -e ${bootdisk} <<-MAKEACTIVE␊ |
␉print␊ |
␉flag ${bootslice}␊ |
␉write␊ |
␉y␊ |
␉quit␊ |
␉MAKEACTIVE␊ |
echo "Executing command: cp /usr/standalone/i386/${filesystemloader} ${bootvolume}"␊ |
cp "${bootvolume}/usr/standalone/i386/${filesystemloader}" "${bootvolume}"␊ |
␊ |
echo "Executing command: ${bootresources}/Tools/SetFile -a V ${bootvolume}/${filesystemloader}"␊ |
"${bootresources}/Tools/SetFile" -a V "${bootvolume}/${filesystemloader}"␊ |
␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
␊ |
␊ |
echo "==============================================="␊ |
echo "Set Active Partition ONLY if Windows is not installed: CHECKED FOR EFI"␊ |
echo "*****************************************************"␊ |
␊ |
if [ ${disksignature} == "00000000" ]; then␊ |
␉# echo "Windows is not installed so let's change the active partition"␊ |
␊ |
␉partitionactive=$( fdisk440 -d ${bootrdisk} | grep -n "*" | awk -F: '{print $1}')␊ |
␉echo "Current Active Partition: ${partitionactive}"␊ |
␊ |
␉if [ "${partitionactive}" = "${bootslice}" ]; then␊ |
␉␉echo "${bootvolume} is already flagged as active"␊ |
␉else␊ |
␉␉echo "${bootvolume} 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.␊ |
␉␉␊ |
␉␉fdisk440 -e ${bootrdisk} <<-MAKEACTIVE␊ |
␉␉print␊ |
␉␉flag ${bootslice}␊ |
␉␉write␊ |
␉␉y␊ |
␉␉quit␊ |
␉␉MAKEACTIVE␊ |
␉fi␊ |
else␊ |
␉echo "Windows is installed so we let that remain the active partition"␊ |
fi␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
␊ |
checkdiskmicrocode check␊ |
checkdisksignature␊ |
checkpartitionbootcode check␊ |
checkpartitionactive␊ |
␊ |
[ -d "${bootvolume}" ] || mkdir -p "${bootvolume}"␊ |
echo "Executing command: mount_hfs ${bootdev} ${bootvolume}"␊ |
mount_hfs "${bootdev}" "${bootvolume}"␊ |
␊ |
echo "Executing command: cp ${osxvolume}${filesystemloader} ${bootvolume}/boot"␊ |
cp "${osxvolume}${filesystemloader}" "${bootvolume}/boot"␊ |
␊ |
#if ! [ -d "${bootvolume}/Extra/Extensions" ]; then␊ |
#␉echo "Executing command: mkdir -p ${bootvolume}/Extra/Extensions"␊ |
#␉mkdir -p "${bootvolume}/Extra/Extensions"␊ |
␊ |
#checkdiskmicrocode check - why check as it would have changed after writing boot0?␊ |
#checkdisksignature - This should still be the same, but if it's changed then it's too late - unless we backed it up?␊ |
#checkpartitionbootcode check - why check as it would have changed after writing boot0?␊ |
␊ |
echo "==============================================="␊ |
echo "Check EFI Partition:"␊ |
echo "***************************"␊ |
echo "Skipping for now"␊ |
# Check efi partition␊ |
#if [ -d /Volumes/EFI ]; then␊ |
#␉umount -f /Volumes/EFI␊ |
#␉rm -R -f /Volumes/EFI␊ |
#fi␊ |
echo "-----------------------------------------------"␊ |
echo ""␊ |
echo ""␊ |
␊ |
if [ -d "${bootvolume}/Extra/Extensions" ]; then␊ |
echo "-----------------------------------------------"␊ |
echo "Duplicating Extra to ExtraBackup Folder, then removing Extra"␊ |
echo "-----------------------------------------------"␊ |
␉echo "Executing command: mkdir -p ${bootvolume}/Extra/Extensions"␊ |
#␉mkdir -p "${bootvolume}/ExtraBackup"␊ |
#␉cp -f -R "${bootvolume}/Extra" "${bootvolume}/ExtraBackup"␊ |
#␉rm -f -R "${bootvolume}/Extra"␊ |
fi␊ |
# unpack any existing Extensions.mkext already on the booter volume␊ |
#if [ -e "${bootvolume}/Extra/Extensions.mkext" ]; then␊ |
#␉echo "Executing command: mkextunpack -d ${bootvolume}/Extra/Extensions ${bootvolume}/Extra/Extensions.mkext"␊ |
#␉mkextunpack -d "${bootvolume}/Extra/Extensions" "${bootvolume}/Extra/Extensions.mkext"␊ |
#␉echo "Executing command: rm -R -f ${bootvolume}/Extra/Extensions.mkext"␊ |
#␉rm -R -f "${bootvolume}/Extra/Extensions.mkext"␊ |
#fi␉␊ |
if [ -f "${2}/ExtraBackup/Extensions.mkext" ]; then␊ |
echo "-----------------------------------------------"␊ |
echo "Mkext section"␊ |
echo "-----------------------------------------------"␊ |
␉echo "Executing command: mkextunpack -d ${2}/Extra/Extensions ${2}/ExtraBackup/Extensions.mkext"␊ |
#␉mkextunpack -d "${2}/.Chameleon/Extra/Extensions" "${2}/.Chameleon/ExtraBackup/Extensions.mkext"␊ |
␉echo "Executing command: rm -R -f ${2}/ExtraBackup/Extensions.mkext"␊ |
#␉rm -R -f "${2}/ExtraBackup/Extensions.mkext"␊ |
fi␉␊ |
␊ |
# copy existing /Extra␊ |
#if [ -d "${2}/Extra" ]; then␊ |
#␉[ -d "${bootvolume}/Extra/Extensions" ] || mkdir -p "${bootvolume}/Extra/Extensions"␊ |
#␉echo "Executing command: find ${2}/Extra -name '*.plist' -depth 1 -exec cp -f {} ${bootvolume}/Extra \;"␊ |
#␉find "${2}/Extra" -name '*.plist' -depth 1 -exec cp -f {} "${bootvolume}/Extra/" \;␊ |
#␉if [ -f "${2}/Extra/Extensions.mkext" ]; then␊ |
#␉␉echo "Executing command: mkextunpack -d ${2}/Extra/Extensions ${2}/Extra/Extensions.mkext"␊ |
#␉␉mkextunpack -d "${bootvolume}/Extra/Extensions" "${2}/Extra/Extensions.mkext"␊ |
#␉fi␊ |
#␉if [ -d "${2}/Extra/Extensions" ]; then␊ |
#␉␉echo "Executing command: find ${2}/Extra/Extensions -name '*.kext' -depth 1 -exec cp -R {} ${bootvolume}/Extra/Extensions \;"␊ |
#␉␉find "${2}/Extra/Extensions" -name '*.kext' -depth 1 -exec cp -R {} "${bootvolume}/Extra/Extensions" \;␊ |
#␉fi␊ |
#fi␊ |
␊ |
# setup link for extras␊ |
#[ -h "${2}/.Chameleon" ] && unlink "${2}/.Chameleon"␊ |
#echo "Executing command: ln -s /Volumes/${bootervolumename} ${2}/.Chameleon"␊ |
#ln -s "/Volumes/${bootervolumename}" "${2}/.Chameleon"␊ |
#echo "Executing command: ln -s . ${2}/.Chameleon"␊ |
#ln -s "${2}" "${2}/.Chameleon"␊ |
␊ |
exit |