decreasing required coreutils version back to 8.22, removed od

This commit is contained in:
My Spaghetti
2020-07-08 03:34:57 +03:00
parent 26961f842e
commit 6a9d1a22bd
2 changed files with 8 additions and 18 deletions
+1 -1
View File
@@ -63,5 +63,5 @@ All the dependencies should be available through a package manager:
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads) ≥ 6.1.6 with Extension Pack, though versions as low as 5.2 may work. * [VirtualBox](https://www.virtualbox.org/wiki/Downloads) ≥ 6.1.6 with Extension Pack, though versions as low as 5.2 may work.
* GNU `Bash` ≥ 4.3, on Windows run through [Cygwin](https://cygwin.com/install.html) or WSL - see [NEM](#virtualbox-native-execution-manager-nem) * GNU `Bash` ≥ 4.3, on Windows run through [Cygwin](https://cygwin.com/install.html) or WSL - see [NEM](#virtualbox-native-execution-manager-nem)
* GNU `coreutils` ≥ 8.23, GNU `gzip` ≥ 1.5, Info-ZIP `unzip` ≥ v6.0, GNU `wget` ≥ 1.14, `xxd` ≥ 1.7 * GNU `coreutils` ≥ 8.22, GNU `gzip` ≥ 1.5, Info-ZIP `unzip` ≥ v6.0, GNU `wget` ≥ 1.14, `xxd` ≥ 1.7
* `dmg2img` ≥ 1.6.5, on Cygwin the package is not available through the package manager so the script downloads it automatically. * `dmg2img` ≥ 1.6.5, on Cygwin the package is not available through the package manager so the script downloads it automatically.
+7 -17
View File
@@ -2,12 +2,12 @@
# 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-virtualbox # url: https://github.com/myspaghetti/macos-virtualbox
# version 0.94.1 # version 0.94.2
# Dependencies: bash coreutils gzip unzip wget xxd dmg2img # Dependencies: bash coreutils gzip unzip wget xxd dmg2img
# Supported versions: # Supported versions:
# VirtualBox with Extension Pack >= 6.1.6 # VirtualBox with Extension Pack >= 6.1.6
# GNU bash >= 4.3, GNU coreutils >= 8.23, # GNU bash >= 4.3, GNU coreutils >= 8.22,
# GNU gzip >= 1.5, GNU wget >= 1.14, # GNU gzip >= 1.5, GNU wget >= 1.14,
# Info-ZIP unzip >= 6.0, xxd >= 1.7, # Info-ZIP unzip >= 6.0, xxd >= 1.7,
# dmg2img >= 1.6.5 # dmg2img >= 1.6.5
@@ -155,9 +155,6 @@ if [[ -n "$(gcsplit --help 2>/dev/null)" ]]; then
function ls() { function ls() {
gls "$@" gls "$@"
} }
function od() {
god "$@"
}
function split() { function split() {
gsplit "$@" gsplit "$@"
} }
@@ -470,13 +467,6 @@ fi
function create_nvram_files() { function create_nvram_files() {
print_dimly "stage: create_nvram_files" print_dimly "stage: create_nvram_files"
# check that od supports the --endian argument
if [[ -n "$(printf '8.23' | od --endian=little 1>/dev/null)" ]]; then
echo "Can't generate NVRAM files because the coreutils version is not 8.23 or higher."
echo "NVRAM files are not required when installing or using macOS, but they are"
echo "required for iMessage connectivity and for apps that authenticate with Apple."
return
fi
# Each NVRAM file may contain multiple entries. # Each NVRAM file may contain multiple entries.
# Each entry contains a namesize, datasize, name, guid, attributes, and data. # Each entry contains a namesize, datasize, name, guid, attributes, and data.
@@ -506,13 +496,13 @@ function generate_nvram_bin_file() {
# size of string in bytes, represented by eight hex digits, big-endian # size of string in bytes, represented by eight hex digits, big-endian
local namesize="$(printf "%08x" $(( ${#name} / 2 )) )" local namesize="$(printf "%08x" $(( ${#name} / 2 )) )"
# flip four big-endian bytes byte-order to little-endian # flip four big-endian bytes byte-order to little-endian
local namesize="$(printf "${namesize}" | xxd -r -p | od -tx4 -N4 -An --endian=little)" local namesize="$(printf "${namesize}" | xxd -r -p | xxd -e -g 4 | xxd -r | xxd -p)"
# strip string-of-hex-bytes representation of data of spaces, "x", "h", etc # strip string-of-hex-bytes representation of data of spaces, "x", "h", etc
local data="$(printf -- "${2}" | xxd -r -p | xxd -p)" local data="$(printf -- "${2}" | xxd -r -p | xxd -p)"
# size of data in bytes, represented by eight hex digits, big-endian # size of data in bytes, represented by eight hex digits, big-endian
local datasize="$(printf "%08x" $(( ${#data} / 2 )) )" local datasize="$(printf "%08x" $(( ${#data} / 2 )) )"
# flip four big-endian bytes byte-order to little-endian # flip four big-endian bytes byte-order to little-endian
local datasize="$(printf "${datasize}" | xxd -r -p | od -tx4 -N4 -An --endian=little)" local datasize="$(printf "${datasize}" | xxd -r -p | xxd -e -g 4 | xxd -r | xxd -p)"
# guid string-of-hex-bytes is five fields, 8+4+4+4+12 nibbles long # guid string-of-hex-bytes is five fields, 8+4+4+4+12 nibbles long
# first three are little-endian, last two big-endian # first three are little-endian, last two big-endian
# for example, 0F1A2B3C-4D5E-6A7B-8C9D-A1B2C3D4E5F6 # for example, 0F1A2B3C-4D5E-6A7B-8C9D-A1B2C3D4E5F6
@@ -524,7 +514,7 @@ function generate_nvram_bin_file() {
# the data structure # the data structure
local entry="${namesize} ${datasize} ${name} ${guid} ${attributes} ${data}" local entry="${namesize} ${datasize} ${name} ${guid} ${attributes} ${data}"
# calculate crc32 using gzip, flip crc32 bytes into big-endian # calculate crc32 using gzip, flip crc32 bytes into big-endian
local crc32="$(printf "${entry}" | xxd -r -p | gzip -c | tail -c8 | od -tx4 -N4 -An --endian=big)" local crc32="$(printf "${entry}" | xxd -r -p | gzip -c | tail -c8 | xxd -p -l 4)"
# save binary data # save binary data
printf -- "${entry} ${crc32}" | xxd -r -p - "${vm_name}_${filename}.bin" printf -- "${entry} ${crc32}" | xxd -r -p - "${vm_name}_${filename}.bin"
} }
@@ -542,7 +532,7 @@ ROM_b16="$(for (( i=0; i<${#ROM}; )); do
echo -n "${ROM:${j}:2}" echo -n "${ROM:${j}:2}"
let i=i+3 let i=i+3
else else
x="$(echo -n "${ROM:${i}:1}" | od -t x1 -An | tr -d ' ')" x="$(echo -n "${ROM:${i}:1}" | xxd -p | tr -d ' ')"
echo -n "${x}" echo -n "${x}"
let i=i+1 let i=i+1
fi fi
@@ -594,7 +584,7 @@ endfor' >> "${vm_name}_startup.nsh"
echo -e "\nCreating VirtualBox 6 virtual ISO containing the" echo -e "\nCreating VirtualBox 6 virtual ISO containing the"
echo -e "installation files from swcdn.apple.com\n" echo -e "installation files from swcdn.apple.com\n"
pseudouuid="$(od -tx -N16 /dev/urandom | xxd -r | xxd -p)" pseudouuid="$(xxd -p -l 16 /dev/urandom)"
pseudouuid="${pseudouuid:0:8}-${pseudouuid:8:4}-${pseudouuid:12:4}-${pseudouuid:16:4}-${pseudouuid:20:12}" pseudouuid="${pseudouuid:0:8}-${pseudouuid:8:4}-${pseudouuid:12:4}-${pseudouuid:16:4}-${pseudouuid:20:12}"
echo "--iprt-iso-maker-file-marker-bourne-sh ${pseudouuid} echo "--iprt-iso-maker-file-marker-bourne-sh ${pseudouuid}
--volume-id=${macOS_release_name:0:5}-files" > "${macOS_release_name}_Installation_files.viso" --volume-id=${macOS_release_name:0:5}-files" > "${macOS_release_name}_Installation_files.viso"