doesn't appear to be a WSL problem after all
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
# One-key semi-automatic installer of macOS on VirtualBox
|
# One-key semi-automatic installer of macOS on VirtualBox
|
||||||
# (c) img2tab, licensed under GPL2.0 or higher
|
# (c) img2tab, licensed under GPL2.0 or higher
|
||||||
# url: https://github.com/img2tab/macos-guest-virtualbox
|
# url: https://github.com/img2tab/macos-guest-virtualbox
|
||||||
# version 0.46
|
# version 0.47
|
||||||
|
|
||||||
# Requirements: 33.5GB available storage on host
|
# Requirements: 33.5GB available storage on host
|
||||||
# Dependencies: bash>=4.0, unzip, wget, dmg2img,
|
# Dependencies: bash>=4.0, unzip, wget, dmg2img,
|
||||||
@@ -99,13 +99,6 @@ if [ -z "$(VBoxManage -v 2>/dev/null)" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# WSL working directory hijinks
|
|
||||||
tmp_path=""
|
|
||||||
if [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" == *"Microsoft"* ]]; then
|
|
||||||
tmp_path="${PWD}/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# dmg2img
|
# dmg2img
|
||||||
if [ -z "$(dmg2img -d 2>/dev/null)" ]; then
|
if [ -z "$(dmg2img -d 2>/dev/null)" ]; then
|
||||||
if [ -z "$(cygcheck -V 2>/dev/null)" ]; then
|
if [ -z "$(cygcheck -V 2>/dev/null)" ]; then
|
||||||
@@ -181,7 +174,7 @@ or http://swscan.apple.com/content/catalogs/others/
|
|||||||
else
|
else
|
||||||
dmg2img "BaseSystem.dmg" "BaseSystem.img"
|
dmg2img "BaseSystem.dmg" "BaseSystem.img"
|
||||||
fi
|
fi
|
||||||
VBoxManage convertfromraw --format VDI "${tmp_path}BaseSystem.img" "${tmp_path}BaseSystem.vdi"
|
VBoxManage convertfromraw --format VDI "BaseSystem.img" "BaseSystem.vdi"
|
||||||
if [ -s BaseSystem.vdi ]; then
|
if [ -s BaseSystem.vdi ]; then
|
||||||
rm "BaseSystem.dmg" "BaseSystem.img" 2>/dev/null
|
rm "BaseSystem.dmg" "BaseSystem.img" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
@@ -199,7 +192,7 @@ elif [ "${storagesize}" -lt 22000 ]; then
|
|||||||
else
|
else
|
||||||
echo "Creating ${vmname} target system virtual disk image."
|
echo "Creating ${vmname} target system virtual disk image."
|
||||||
VBoxManage createmedium --size="${storagesize}" \
|
VBoxManage createmedium --size="${storagesize}" \
|
||||||
--filename "${tmp_path}${vmname}.vdi" \
|
--filename "${vmname}.vdi" \
|
||||||
--variant standard 2>/dev/tty
|
--variant standard 2>/dev/tty
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -211,7 +204,7 @@ if [ -r "Install ${vmname}.vdi" ]; then
|
|||||||
else
|
else
|
||||||
echo "Creating ${vmname} installation media virtual disk image."
|
echo "Creating ${vmname} installation media virtual disk image."
|
||||||
VBoxManage createmedium --size=8000 \
|
VBoxManage createmedium --size=8000 \
|
||||||
--filename "${tmp_path}Install ${vmname}.vdi" \
|
--filename "Install ${vmname}.vdi" \
|
||||||
--variant fixed 2>/dev/tty
|
--variant fixed 2>/dev/tty
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -221,11 +214,11 @@ fi
|
|||||||
function attach_initial_storage() {
|
function attach_initial_storage() {
|
||||||
VBoxManage storagectl "${vmname}" --add sata --name SATA --hostiocache on
|
VBoxManage storagectl "${vmname}" --add sata --name SATA --hostiocache on
|
||||||
VBoxManage storageattach "${vmname}" --storagectl SATA --port 0 \
|
VBoxManage storageattach "${vmname}" --storagectl SATA --port 0 \
|
||||||
--type hdd --nonrotational on --medium "${tmp_path}${vmname}.vdi"
|
--type hdd --nonrotational on --medium "${vmname}.vdi"
|
||||||
VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 \
|
VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 \
|
||||||
--type hdd --nonrotational on --medium "${tmp_path}Install ${vmname}.vdi"
|
--type hdd --nonrotational on --medium "Install ${vmname}.vdi"
|
||||||
VBoxManage storageattach "${vmname}" --storagectl SATA --port 2 \
|
VBoxManage storageattach "${vmname}" --storagectl SATA --port 2 \
|
||||||
--type hdd --nonrotational on --medium "${tmp_path}BaseSystem.vdi"
|
--type hdd --nonrotational on --medium "BaseSystem.vdi"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Configure the VM
|
# Configure the VM
|
||||||
@@ -643,8 +636,8 @@ read -n 1 -p " [y/n] " delete 2>/dev/tty
|
|||||||
echo ""
|
echo ""
|
||||||
if [ "${delete}" == "y" ]; then
|
if [ "${delete}" == "y" ]; then
|
||||||
# temporary files cleanup
|
# temporary files cleanup
|
||||||
VBoxManage closemedium "${tmp_path}BaseSystem.vdi"
|
VBoxManage closemedium "BaseSystem.vdi"
|
||||||
VBoxManage closemedium "${tmp_path}Install ${vmname}.vdi"
|
VBoxManage closemedium "Install ${vmname}.vdi"
|
||||||
rm "BaseSystem.vdi" "Install ${vmname}.vdi"
|
rm "BaseSystem.vdi" "Install ${vmname}.vdi"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user