if less is installed, suggest "script.sh documentation | less -R"

This commit is contained in:
Jack
2020-01-31 14:14:46 +02:00
parent 4c3db4b3f6
commit d36132b0a3
+45 -33
View File
@@ -64,9 +64,10 @@ The installation requires about '"${highlight_color}"'40GB'"${default_color}"' o
temporary installation files and 15GB for the virtual machine'"'"'s dynamically temporary installation files and 15GB for the virtual machine'"'"'s dynamically
allocated storage disk image. allocated storage disk image.
The script can be resumed by stages, as described in the following command: The script can be resumed, as described when running the following command:
'"${highlight_color}${0}"' documentation'"${default_color}"' '
would_you_like_to_know_less
printf '
'"${highlight_color}"'Press enter to review the script settings.'"${default_color}" '"${highlight_color}"'Press enter to review the script settings.'"${default_color}"
clear_input_buffer_then_read clear_input_buffer_then_read
@@ -326,9 +327,8 @@ if [ -n "$(VBoxManage showvminfo "${vmname}" 2>/dev/null)" ]; then
else else
printf ' printf '
'"${highlight_color}"'Please assign a different VM name to variable "vmname" by editing the script,'"${default_color}"' '"${highlight_color}"'Please assign a different VM name to variable "vmname" by editing the script,'"${default_color}"'
or skip this check manually as described when running the following command: or skip this check manually as described when running the following command:'
'"${0}"' documentation would_you_like_to_know_less
'
exit exit
fi fi
fi fi
@@ -821,11 +821,10 @@ booting into the initial installer environment again.'
fi fi
printf ' printf '
For further information, such as applying EFI and NVRAM variables to enable For further information, such as applying EFI and NVRAM variables to enable
iMessage connectivity, see the documentation with the following command: iMessage connectivity, see the documentation with the following command:'
'"${highlight_color}${0}"' documentation'"${default_color}"' would_you_like_to_know_less
printf "${highlight_color}"'That'"'"'s it! Enjoy your virtual machine.'"${default_color}"'\n'
'"${highlight_color}"'That'"'"'s it! Enjoy your virtual machine.'"${default_color}"'\n'
} }
@@ -880,6 +879,10 @@ fi
} }
function documentation() { function documentation() {
low_contrast_stages=""
for stage in ${stages}; do
low_contrast_stages="${low_contrast_stages}"' '"${low_contrast_color}${stage}${default_color}"'\n'
done
printf " printf "
${highlight_color}NAME${default_color} ${highlight_color}NAME${default_color}
Semi-automatic installer of macOS on VirtualBox Semi-automatic installer of macOS on VirtualBox
@@ -897,7 +900,8 @@ 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 \"documentation\", is executed
in succession in the order listed: in succession in the order listed:
${low_contrast_color}${stages}${default_color}
${low_contrast_stages}
When \"documentation\" is the first command-line argument, only the When \"documentation\" is the first command-line argument, only the
\"documentation\" stage is executed and all other arguments are ignored. \"documentation\" stage is executed and all other arguments are ignored.
@@ -933,19 +937,19 @@ and other apps that authenticate the device with Apple.
The variables needed to be assigned in the script are the following: The variables needed to be assigned in the script are the following:
${low_contrast_color}DmiSystemFamily # Model name ${low_contrast_color}DmiSystemFamily # Model name${default_color}
DmiSystemProduct # Model identifier ${low_contrast_color}DmiSystemProduct # Model identifier${default_color}
DmiSystemSerial # System serial number ${low_contrast_color}DmiSystemSerial # System serial number${default_color}
DmiSystemUuid # Hardware UUID ${low_contrast_color}DmiSystemUuid # Hardware UUID${default_color}
DmiOEMVBoxVer # Apple ROM info (major version) ${low_contrast_color}DmiOEMVBoxVer # Apple ROM info (major version)${default_color}
DmiOEMVBoxRev # Apple ROM info (revision) ${low_contrast_color}DmiOEMVBoxRev # Apple ROM info (revision)${default_color}
DmiBIOSVersion # Boot ROM version ${low_contrast_color}DmiBIOSVersion # Boot ROM version${default_color}
DmiBoardProduct # Main Logic Board identifier ${low_contrast_color}DmiBoardProduct # Main Logic Board identifier${default_color}
DmiBoardSerial # Main Logic Board serial (EFI) ${low_contrast_color}DmiBoardSerial # Main Logic Board serial (EFI)${default_color}
MLB # Main Logic Board serial (NVRAM) ${low_contrast_color}MLB # Main Logic Board serial (NVRAM)${default_color}
ROM # ROM identifier (NVRAM) ${low_contrast_color}ROM # ROM identifier (NVRAM)${default_color}
SYSTEM_UUID # System identifier (NVRAM) ${low_contrast_color}SYSTEM_UUID # System identifier (NVRAM)${default_color}
${default_color}
The comments at the top of the script specify how to view these variables The comments at the top of the script specify how to view these variables
on a genuine Mac. on a genuine Mac.
@@ -972,12 +976,12 @@ machine's storage through VirtualBox Manager or VBoxManage. Power up the VM
and boot macOS, then start Terminal and execute the following commands, making and boot macOS, then start Terminal and execute the following commands, making
sure to replace \"/Volumes/path/to/VISO/startup.nsh\" with the correct path: sure to replace \"/Volumes/path/to/VISO/startup.nsh\" with the correct path:
${low_contrast_color}mkdir EFI ${low_contrast_color}mkdir EFI${default_color}
sudo su # this will prompt for a password ${low_contrast_color}sudo su # this will prompt for a password${default_color}
mount_ntfs /dev/disk0s1 EFI ${low_contrast_color}mount_ntfs /dev/disk0s1 EFI${default_color}
cp /Volumes/path/to/VISO/startup.nsh ./EFI/startup.nsh ${low_contrast_color}cp /Volumes/path/to/VISO/startup.nsh ./EFI/startup.nsh${default_color}
cp /Volumes/path/to/VISO/*.bin ./EFI/ ${low_contrast_color}cp /Volumes/path/to/VISO/*.bin ./EFI/${default_color}
${default_color}
After copying the files, boot into the EFI Internal Shell as desribed in the After copying the files, boot into the EFI Internal Shell as desribed in the
section \"Applying the EFI and NVRAM parameters\". section \"Applying the EFI and NVRAM parameters\".
@@ -1235,6 +1239,14 @@ function cycle_through_terminal_windows() {
sleep 1 sleep 1
} }
function would_you_like_to_know_less() {
if [ -z "$(less --version 2>/dev/null)" ]; then
printf ' '"${highlight_color}${0} documentation${default_color}"'\n'
else
printf ' '"${highlight_color}${0} documentation | less -R${default_color}"'\n'
fi
}
# command-line argument processing # command-line argument processing
stages=' stages='
check_bash_version check_bash_version
@@ -1261,11 +1273,11 @@ stages_without_newlines="$(printf "${stages}" | tr -d '\n')"
[ -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
for argument in $@; do for argument in $@; do
[[ ${stages} != *" ${argument} "* ]] && [[ "${stages_without_newlines}" != *" ${argument} "* ]] &&
echo "" &&
echo "Can't parse one or more specified arguments. See documentation" && echo "Can't parse one or more specified arguments. See documentation" &&
echo "by entering the following command:" && echo "by entering the following command:" &&
echo " ${0} documentation" && would_you_like_to_know_less && echo "" && exit
exit
done done
check_bash_version check_bash_version
check_gnu_coreutils_prefix check_gnu_coreutils_prefix