Created
December 16, 2017 00:32
-
-
Save swcho/3667feb1c970a6de62d2a180785eeb7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VM_NAME=$1 | |
if [ -z "$VM_NAME"] | |
then | |
# https://stackoverflow.com/questions/9449417/how-do-i-assign-the-output-of-a-command-into-an-array | |
IFS=$'\n' | |
VM_NAMES=( $(VBoxManage list vms | sed -En 's/"(.*)".*/\1/p') ) | |
unset IFS | |
# https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script | |
select VM_NAME in "${VM_NAMES[@]}" | |
do | |
break; | |
done | |
fi | |
VBOX_VERSION=$(VBoxManage -v) | |
echo "Configureing '$VM_NAME' for VirtualBox version $VBOX_VERSION" | |
# https://techsviewer.com/how-to-install-mac-os-x-el-capitan-on-pc-on-virtualbox/ | |
if [[ "$VBOX_VERSION" =~ ^4\..* ]]; then | |
echo 'Version 4.xx' | |
# Code for Virtualbox 4.xx | |
VBoxManage modifyvm "$VM_NAME" --cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro11,3" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1 | |
fi | |
if [[ "$VBOX_VERSION" =~ ^5\..* ]]; then | |
echo 'Version 5.xx' | |
# Code for Virtualbox 5.xx | |
VBoxManage modifyvm "$VM_NAME" --cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff | |
VBoxManage modifyvm "$VM_NAME" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" | |
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment