new "troubleshoot" stage for log-dumping

This commit is contained in:
Jack
2020-03-24 19:59:09 +02:00
parent 3810159f05
commit 86a4c65853
+46 -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.3 # version 0.88.4
# 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,
@@ -12,7 +12,7 @@ function set_variables() {
# Customize the installation by setting these variables: # Customize the installation by setting these variables:
vm_name="macOS" # name of the VirtualBox virtual machine vm_name="macOS" # name of the VirtualBox virtual machine
macOS_release_name="Catalina" # install "HighSierra" "Mojave" or "Catalina" macOS_release_name="Catalina" # install "HighSierra" "Mojave" or "Catalina"
storage_size=80000 # VM disk image size in MB. Minimum 22000 storage_size=80000 # VM disk image size in MB, minimum 22000
cpu_count=2 # VM CPU cores, minimum 2 cpu_count=2 # VM CPU cores, minimum 2
memory_size=4096 # VM RAM in MB, minimum 2048 memory_size=4096 # VM RAM in MB, minimum 2048
gpu_vram=128 # VM video RAM in MB, minimum 34, maximum 128 gpu_vram=128 # VM video RAM in MB, minimum 34, maximum 128
@@ -961,17 +961,19 @@ patiently and, less than ten times, press enter when prompted.
The script is divided into stages. Stage titles may be given as command-line The script is divided into stages. Stage titles may be given as command-line
arguments for the script. When the script is run with no command-line arguments for the script. When the script is run with no command-line
arguments, each of the available stages, except \"documentation\", is executed arguments, each of the available stages except \"${low_contrast_color}documentation${default_color}\" and
in succession in the order listed: \"${low_contrast_color}troubleshoot${default_color}\" is executed in succession in the order listed:
${low_contrast_stages} ${low_contrast_stages}
When \"documentation\" is the first command-line argument, only the The stage \"${low_contrast_color}documentation${default_color}\" or \"${low_contrast_color}troubleshoot${default_color}\" is only executed when it is
\"documentation\" stage is executed and all other arguments are ignored. specified as the first command-line argument, with all subsequent arguments
ignored. When specified after any argument, \"${low_contrast_color}documentation${default_color}\" or \"${low_contrast_color}troubleshoot${default_color}\"
is ignored.
The four stages \"check_bash_version\", \"check_gnu_coreutils_prefix\", The four stages \"${low_contrast_color}check_bash_version${default_color}\", \"${low_contrast_color}check_gnu_coreutils_prefix${default_color}\",
\"set_variables\", and \"check_dependencies\" are always performed when any stage \"${low_contrast_color}set_variables${default_color}\", and \"${low_contrast_color}check_dependencies${default_color}\" are always performed when any stage
title other than \"documentation\" is specified first, and if the checks pass title other than \"${low_contrast_color}documentation${default_color}\" or \"${low_contrast_color}troubleshoot${default_color}\" is specified as the first
then the stages specified in the command-line arguments are performed. argument, and the rest of the stages are parsed only after the checks pass.
${highlight_color}EXAMPLES${default_color} ${highlight_color}EXAMPLES${default_color}
${low_contrast_color}${0} configure_vm${default_color} ${low_contrast_color}${0} configure_vm${default_color}
@@ -1104,6 +1106,33 @@ Further information is available at the following URL:
" "
} }
function troubleshoot() {
head -n 5 "${0}"
echo '################################################################################'
echo 'BASH_VERSION '"${BASH_VERSION}"
echo 'VBOX_VERSION '"$(VBoxManage -v)"
echo '################################################################################'
echo 'vbox.log'
VBoxManage showvminfo "${vm_name}" --log 0
echo '################################################################################'
echo 'vminfo'
VBoxManage showvminfo "${vm_name}" --machinereadable --details
VBoxManage getextradata "${vm_name}"
echo '################################################################################'
echo 'OS info'
sw_vers 2>/dev/null
cat /proc/sys/kernel/osrelease 2>/dev/null
echo '################################################################################'
echo 'md5 hashes'
md5sum "${macOS_release_name}_BaseSystem"* 2>/dev/null
md5sum "${macOS_release_name}_Install"* 2>/dev/null
md5sum "${macOS_release_name}_Apple"* 2>/dev/null
md5 "${macOS_release_name}_BaseSystem"* 2>/dev/null
md5 "${macOS_release_name}_Install"* 2>/dev/null
md5 "${macOS_release_name}_Apple"* 2>/dev/null
echo '################################################################################'
}
# GLOBAL VARIABLES AND FUNCTIONS THAT MIGHT BE CALLED MORE THAN ONCE # GLOBAL VARIABLES AND FUNCTIONS THAT MIGHT BE CALLED MORE THAN ONCE
# terminal text colors # terminal text colors
@@ -1356,12 +1385,16 @@ stages='
populate_virtual_disks populate_virtual_disks
populate_macos_target populate_macos_target
delete_temporary_files delete_temporary_files
documentation
troubleshoot
' '
stages_without_newlines="$(printf "${stages}" | tr -d '\n')" stages_without_newlines="$(printf "${stages}" | tr -d '\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
for argument in $@; do for argument in $@; do
[[ "${stages_without_newlines}" != *" ${argument} "* ]] && [[ "${stages_without_newlines}" != *" ${argument} "* ]] &&
echo "" && echo "" &&
@@ -1373,4 +1406,4 @@ check_bash_version
check_gnu_coreutils_prefix check_gnu_coreutils_prefix
set_variables set_variables
check_dependencies check_dependencies
for argument in "$@"; do ${argument}; done for argument in "$@"; do [[ "${argument}" != "documentation" && "${argument}" != "troubleshoot" ]] && ${argument}; done