alphabetized gnu utils, cleaned up delete_temporary_files()
This commit is contained in:
+31
-35
@@ -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.90.4
|
# version 0.90.5
|
||||||
|
|
||||||
# Dependencies: bash coreutils gzip unzip wget xxd dmg2img
|
# Dependencies: bash coreutils gzip unzip wget xxd dmg2img
|
||||||
# Supported versions:
|
# Supported versions:
|
||||||
@@ -142,7 +142,7 @@ elif [[ "${SHELL}" =~ /zsh ]]; then
|
|||||||
echo "Please run this script on zsh version 5.5 or higher."
|
echo "Please run this script on zsh version 5.5 or higher."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
setopt extendedglob sh_word_split ksh_arrays posix_argzero
|
setopt extendedglob sh_word_split ksh_arrays posix_argzero nullglob
|
||||||
else
|
else
|
||||||
echo "Can't determine SHELL. Exiting."
|
echo "Can't determine SHELL. Exiting."
|
||||||
exit
|
exit
|
||||||
@@ -151,24 +151,27 @@ fi
|
|||||||
|
|
||||||
function check_gnu_coreutils_prefix() {
|
function check_gnu_coreutils_prefix() {
|
||||||
if [[ -n "$(gcsplit --help 2>/dev/null)" ]]; then
|
if [[ -n "$(gcsplit --help 2>/dev/null)" ]]; then
|
||||||
function csplit() {
|
|
||||||
gcsplit "$@"
|
|
||||||
}
|
|
||||||
function tac() {
|
|
||||||
gtac "$@"
|
|
||||||
}
|
|
||||||
function split() {
|
|
||||||
gsplit "$@"
|
|
||||||
}
|
|
||||||
function base64() {
|
function base64() {
|
||||||
gbase64 "$@"
|
gbase64 "$@"
|
||||||
}
|
}
|
||||||
|
function csplit() {
|
||||||
|
gcsplit "$@"
|
||||||
|
}
|
||||||
function expr() {
|
function expr() {
|
||||||
gexpr "$@"
|
gexpr "$@"
|
||||||
}
|
}
|
||||||
|
function ls() {
|
||||||
|
gls "$@"
|
||||||
|
}
|
||||||
function od() {
|
function od() {
|
||||||
god "$@"
|
god "$@"
|
||||||
}
|
}
|
||||||
|
function split() {
|
||||||
|
gsplit "$@"
|
||||||
|
}
|
||||||
|
function tac() {
|
||||||
|
gtac "$@"
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,37 +948,30 @@ else
|
|||||||
# detach temporary VDIs and attach the macOS target disk
|
# detach temporary VDIs and attach the macOS target disk
|
||||||
VBoxManage storagectl "${vm_name}" --remove --name SATA >/dev/null 2>&1
|
VBoxManage storagectl "${vm_name}" --remove --name SATA >/dev/null 2>&1
|
||||||
VBoxManage storagectl "${vm_name}" --add sata --name SATA --hostiocache on >/dev/null 2>&1
|
VBoxManage storagectl "${vm_name}" --add sata --name SATA --hostiocache on >/dev/null 2>&1
|
||||||
|
if [[ -s "${vm_name}.vdi" ]]; then
|
||||||
VBoxManage storageattach "${vm_name}" --storagectl SATA --port 0 \
|
VBoxManage storageattach "${vm_name}" --storagectl SATA --port 0 \
|
||||||
--type hdd --nonrotational on --medium "${vm_name}.vdi"
|
--type hdd --nonrotational on --medium "${vm_name}.vdi"
|
||||||
|
fi
|
||||||
VBoxManage closemedium "Install ${macOS_release_name}.vdi" >/dev/null 2>&1
|
VBoxManage closemedium "Install ${macOS_release_name}.vdi" >/dev/null 2>&1
|
||||||
VBoxManage closemedium "${macOS_release_name}_BaseSystem.vdi" >/dev/null 2>&1
|
VBoxManage closemedium "${macOS_release_name}_BaseSystem.vdi" >/dev/null 2>&1
|
||||||
printf 'The following temporary files are safe to delete:
|
echo 'The following temporary files are safe to delete:'
|
||||||
"'"${macOS_release_name}_Apple"*'"
|
|
||||||
"'"${macOS_release_name}_BaseSystem"*'"
|
|
||||||
"'"${macOS_release_name}_Install"*'"
|
|
||||||
"'"Install ${macOS_release_name}.vdi"'"
|
|
||||||
"'"${vm_name}_"*".bin"'"
|
|
||||||
"'"${vm_name}_startup.nsh"'"
|
|
||||||
"'"ApfsDriverLoader.efi"'"
|
|
||||||
"'"Apple"*".efi"'"
|
|
||||||
"'"AppleSupport-v2.0.4-RELEASE.zip"'"\n'
|
|
||||||
if [[ -w "dmg2img.exe" ]]; then
|
|
||||||
printf ' "'"dmg2img.exe"'"\n'
|
|
||||||
fi
|
|
||||||
echo ""
|
echo ""
|
||||||
printf "${warning_color}"'Delete temporary files?'"${default_color}"
|
temporary_files=("${macOS_release_name}_Apple"*
|
||||||
|
"${macOS_release_name}_BaseSystem"*
|
||||||
|
"${macOS_release_name}_Install"*
|
||||||
|
"Install ${macOS_release_name}.vdi"
|
||||||
|
"${vm_name}_"*".bin"
|
||||||
|
"${vm_name}_startup.nsh"
|
||||||
|
"ApfsDriverLoader.efi"
|
||||||
|
"Apple"*".efi"
|
||||||
|
"AppleSupport-v2.0.4-RELEASE.zip"
|
||||||
|
"dmg2img.exe")
|
||||||
|
ls -d "${temporary_files[@]}" 2>/dev/null
|
||||||
|
echo ""
|
||||||
|
printf "${warning_color}"'Delete temporary files listed above?'"${default_color}"
|
||||||
prompt_delete_y_n
|
prompt_delete_y_n
|
||||||
if [[ "${delete}" == "y" ]]; then
|
if [[ "${delete}" == "y" ]]; then
|
||||||
rm "${macOS_release_name}_Apple"* \
|
rm -f "${temporary_files[@]}" 2>/dev/null
|
||||||
"${macOS_release_name}_BaseSystem"* \
|
|
||||||
"${macOS_release_name}_Install"* \
|
|
||||||
"Install ${macOS_release_name}.vdi" \
|
|
||||||
"${vm_name}_"*".bin" \
|
|
||||||
"${vm_name}_startup.nsh" \
|
|
||||||
"ApfsDriverLoader.efi" \
|
|
||||||
"Apple"*".efi" \
|
|
||||||
"AppleSupport-v2.0.4-RELEASE.zip" 2>/dev/null
|
|
||||||
rm "dmg2img.exe" 2>/dev/null
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user