From ccdacd0c6fdfaca5fbd9826dbb05b76e1d65fc6a Mon Sep 17 00:00:00 2001 From: Scott Bronson Date: Mon, 4 Mar 2019 21:54:20 -0800 Subject: [PATCH 1/3] Use VBoxManage if installed in the default location --- README.md | 4 +++- macos-guest-virtualbox.sh | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 39a191c..709aaab 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The "one key" is enter, which has to be pressed whenever the virtual machine is The goal of the script is to allow for a very easy installation without any closed-source additions or extra bootloaders. -Tested on Cygwin, should work on Linux distros. +Tested on Cygwin, should work on Linux distros (including WSL). ## iCloud and iMessage connectivity @@ -24,3 +24,5 @@ Developing and maintaining VirtualBox features is beyond the scope of this scrip * `Bash`≥4 (run on Windows through [Cygwin](https://cygwin.com/install.html)) * `unzip`, `wget` (install through package manager) * `dmg2img` (install through package manager on Linux; let the script download it automatically on Windows) + +For Debian and Ubuntu: `sudo apt install d2img unzip wget` diff --git a/macos-guest-virtualbox.sh b/macos-guest-virtualbox.sh index 0f4166a..48fcaa9 100644 --- a/macos-guest-virtualbox.sh +++ b/macos-guest-virtualbox.sh @@ -90,13 +90,20 @@ fi # VirtualBox in ${PATH} if [ -z "$(VBoxManage -v 2>/dev/null)" ]; then - echo "Please make sure VirtualBox is installed, and that the path to" - echo "the VBoxManage executable is in the PATH variable." - if [ -n "${windows}" ]; then echo -n "VBoxManage is usually installed in" - echo "/cygdrive/c/Program Files/Oracle/VirtualBox" - echo "and can be added with PATH=\"\${PATH}:/cygdrive/c/<...>\"" + if [ -x '/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' ]; then + # If VBoxManage.exe is in the standard install location, use it. + VBoxManage () { + '/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' "$@" + } + else + echo "Please make sure VirtualBox is installed, and that the path to" + echo "the VBoxManage executable is in the PATH variable." + if [ -n "${windows}" ]; then echo -n "VBoxManage is usually installed in" + echo "/cygdrive/c/Program Files/Oracle/VirtualBox" + echo "and can be added with PATH=\"\${PATH}:/cygdrive/c/<...>\"" + fi + exit fi - exit fi # dmg2img From 1815626f33cb1692e0b10ee21c43290fb3680de3 Mon Sep 17 00:00:00 2001 From: img2tab <31696646+img2tab@users.noreply.github.com> Date: Wed, 6 Mar 2019 04:24:06 +0000 Subject: [PATCH 2/3] removed distro-specific instructions --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 709aaab..9d8cdb6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The "one key" is enter, which has to be pressed whenever the virtual machine is The goal of the script is to allow for a very easy installation without any closed-source additions or extra bootloaders. -Tested on Cygwin, should work on Linux distros (including WSL). +Tested on Cygwin, usually works on Linux distros and WSL. ## iCloud and iMessage connectivity @@ -21,8 +21,6 @@ Developing and maintaining VirtualBox features is beyond the scope of this scrip ## Dependencies * [VirtualBox](https://www.virtualbox.org/wiki/Downloads)≥5.2 with Extension Pack -* `Bash`≥4 (run on Windows through [Cygwin](https://cygwin.com/install.html)) +* `Bash`≥4 (run on Windows through [Cygwin](https://cygwin.com/install.html) or WSL) * `unzip`, `wget` (install through package manager) -* `dmg2img` (install through package manager on Linux; let the script download it automatically on Windows) - -For Debian and Ubuntu: `sudo apt install d2img unzip wget` +* `dmg2img` (install through package manager on Linux and WSL; let the script download it automatically on Cygwin) From a63e85c6a65e26e4538bb9d8cafd1d9acba50e7a Mon Sep 17 00:00:00 2001 From: img2tab <31696646+img2tab@users.noreply.github.com> Date: Wed, 6 Mar 2019 04:37:18 +0000 Subject: [PATCH 3/3] check if VBoxManage executes --- macos-guest-virtualbox.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/macos-guest-virtualbox.sh b/macos-guest-virtualbox.sh index 48fcaa9..4345046 100644 --- a/macos-guest-virtualbox.sh +++ b/macos-guest-virtualbox.sh @@ -90,18 +90,18 @@ fi # VirtualBox in ${PATH} if [ -z "$(VBoxManage -v 2>/dev/null)" ]; then - if [ -x '/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' ]; then + if [ -n "$('/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' -v 2>/dev/null)" ]; then # If VBoxManage.exe is in the standard install location, use it. - VBoxManage () { + function VBoxManage() { '/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' "$@" } + elif [ -n "$('/cygdrive/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' -v 2>/dev/null)" ]; then + function VBoxManage() { + '/cygdrive/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' "$@" + } else echo "Please make sure VirtualBox is installed, and that the path to" echo "the VBoxManage executable is in the PATH variable." - if [ -n "${windows}" ]; then echo -n "VBoxManage is usually installed in" - echo "/cygdrive/c/Program Files/Oracle/VirtualBox" - echo "and can be added with PATH=\"\${PATH}:/cygdrive/c/<...>\"" - fi exit fi fi