a bit of cleanup on troubleshoot output

This commit is contained in:
Jack
2020-04-02 03:09:30 +03:00
parent d51e310e7e
commit 7968d11493
+13 -13
View File
@@ -2,7 +2,7 @@
# Push-button installer of macOS on VirtualBox # Push-button installer of macOS on VirtualBox
# (c) myspaghetti, licensed under GPL2.0 or higher # (c) myspaghetti, licensed under GPL2.0 or higher
# url: https://github.com/myspaghetti/macos-guest-virtualbox # url: https://github.com/myspaghetti/macos-guest-virtualbox
# version 0.88.6 # version 0.88.7
# Requirements: 40GB available storage on host # Requirements: 40GB available storage on host
# Dependencies: bash >= 4.3, xxd, gzip, unzip, wget, dmg2img, # Dependencies: bash >= 4.3, xxd, gzip, unzip, wget, dmg2img,
@@ -252,7 +252,7 @@ fi
# VirtualBox version # VirtualBox version
vbox_version="$(VBoxManage -v 2>/dev/null)" vbox_version="$(VBoxManage -v 2>/dev/null)"
vbox_version="$( printf ${vbox_version} | tr -d '\r')" vbox_version="${vbox_version//[$'\r\n']/}"
if [[ -z "${vbox_version}" || -z "${vbox_version:2:1}" ]]; then if [[ -z "${vbox_version}" || -z "${vbox_version:2:1}" ]]; then
echo "Can't determine VirtualBox version. Exiting." echo "Can't determine VirtualBox version. Exiting."
exit exit
@@ -1110,19 +1110,19 @@ function troubleshoot() {
head -n 5 "${0}" head -n 5 "${0}"
echo '################################################################################' echo '################################################################################'
echo 'BASH_VERSION '"${BASH_VERSION}" echo 'BASH_VERSION '"${BASH_VERSION}"
echo 'VBOX_VERSION '"$(VBoxManage -v)" vbox_ver="$(VBoxManage -v)"
macosver="$(sw_vers 2>/dev/null)" echo 'VBOX_VERSION '"${vbox_ver//[$'\r\n']/}"
wslver="$(cat /proc/sys/kernel/osrelease 2>/dev/null)" macos_ver="$(sw_vers 2>/dev/null)"
winver="$(cmd.exe /d /s /c call ver 2>/dev/null)" wsl_ver="$(cat /proc/sys/kernel/osrelease 2>/dev/null)"
echo 'OS VERSION '"${macosver}${wslver}${winver}" win_ver="$(cmd.exe /d /s /c call ver 2>/dev/null)"
echo '' echo 'OS VERSION '"${macos_ver}${wsl_ver}${win_ver//[$'\r\n']/}"
echo '################################################################################' echo '################################################################################'
echo 'vbox.log' echo 'vbox.log'
VBoxManage showvminfo "${vm_name}" --log 0 VBoxManage showvminfo "${vm_name}" --log 0 2>&1
echo '################################################################################' echo '################################################################################'
echo 'vminfo' echo 'vminfo'
VBoxManage showvminfo "${vm_name}" --machinereadable --details VBoxManage showvminfo "${vm_name}" --machinereadable --details 2>&1
VBoxManage getextradata "${vm_name}" VBoxManage getextradata "${vm_name}" 2>&1
echo '################################################################################' echo '################################################################################'
echo 'md5 hashes' echo 'md5 hashes'
md5sum "${macOS_release_name}_BaseSystem"* 2>/dev/null md5sum "${macOS_release_name}_BaseSystem"* 2>/dev/null
@@ -1390,12 +1390,12 @@ stages='
documentation documentation
troubleshoot troubleshoot
' '
stages_without_newlines="$(printf "${stages}" | tr -d '\n')" stages_without_newlines="${stages//[$'\r\n']/}"
# every stage name must be preceded and followed by a space character # every stage name must be preceded and followed by a space character
# for the command-line argument checking below to work # for the command-line argument checking below to work
[[ -z "${1}" ]] && for stage in ${stages}; do ${stage}; done && exit [[ -z "${1}" ]] && for stage in ${stages}; do ${stage}; done && exit
[[ "${1}" = "documentation" ]] && documentation && exit [[ "${1}" = "documentation" ]] && documentation && exit
if [[ "${1}" = "troubleshoot" ]]; then set_variables; troubleshoot; exit; fi if [[ "${1}" = "troubleshoot" ]]; then set_variables; check_dependencies >/dev/null; troubleshoot; exit; fi
for argument in $@; do for argument in $@; do
[[ "${stages_without_newlines}" != *" ${argument} "* ]] && [[ "${stages_without_newlines}" != *" ${argument} "* ]] &&
echo "" && echo "" &&