From 15475ee8185479cabd13fa7e2b5857f8cb58b4e5 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Mon, 8 Mar 2021 13:38:52 +0000 Subject: [PATCH] Simplify options. Make inputy/master/custom plist all the same option. --- README.md | 27 +++++++++++++---- generate-specific-bootdisk.sh | 35 +++++++++++----------- generate-unique-machine-values.sh | 50 +++++++++++++++---------------- 3 files changed, 65 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 968646b..3a28148 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ https://github.com/sickcodes/osx-serial-generator/blob/master/CREDITS.md # Purpose -These script were written by @sickcodes [https://twitter.com/sickcodes](https://twitter.com/sickcodes) for automating generating unique values at runtime in [Docker-OSX](https://github.com/sickcodes/Docker-OSX). +These script were written by [@sickcodes](https://github.com/sickcodes) [https://twitter.com/sickcodes](https://twitter.com/sickcodes) for automating generating unique values at runtime in [Docker-OSX](https://github.com/sickcodes/Docker-OSX). This is for generating sets of serial numbers that simply work. @@ -39,7 +39,7 @@ Used at runtime in [Docker-OSX](https://github.com/sickcodes/Docker-OSX). ```bash # Ubuntu/Debian/Pop -sudo apt update -y && sudo apt install libguestfs-tools build-essential wget git -y +sudo apt update -y && sudo apt install libguestfs-tools build-essential ld wget git -y # Fedora, RHEL, CentOS sudo yum install libguestfs wget git -y @@ -53,13 +53,28 @@ sudo pacman -Sy libguestfs wget git base-devel # Generating New Unique Serial Numbers Example -```bash -# make 1 serial set, using -./generate-unique-machine-values.sh -c 1 +```bash +# make 1 full serial set +./generate-unique-machine-values.sh -c 1 --model="iMacPro1,1" +``` + +Done! + +Slip those values into your config.plist and reboot! + +## Extended options + +### Need more serials? + +```bash # make 100 serial sets ./generate-unique-machine-values.sh -c 100 --model="iMacPro1,1" +``` +### Want me to make an OpenCore bootdisk AND output plists? + +```bash # make 5 serial sets, but also make config.plist for each set, and OpenCore-nopicker.qcow2 for each serial set. ./generate-unique-machine-values.sh -c 5 --plists --bootdisks ``` @@ -75,6 +90,8 @@ If you want to use placeholders, you can supply that to either of the scripts in ./generate-unique-machine-values.sh -c 5 --custom-plist=./my_config.plist --bootdisks ``` +You can also use an URL for the input plist using `--master-plist-url`. + Or you can manually enter the values generated above: ```xml diff --git a/generate-specific-bootdisk.sh b/generate-specific-bootdisk.sh index f5e9800..857a37e 100755 --- a/generate-specific-bootdisk.sh +++ b/generate-specific-bootdisk.sh @@ -24,9 +24,10 @@ Required options: Optional options: --width Resolution x axis length in px, default 1920 --height Resolution y axis length in px, default 1080 - --master-plist-url Specify an alternative master plist, via URL - --custom-plist - || --master-plist Optionally change the input plist. + --input-plist-url Specify an alternative master plist, via URL + --master-plist-url Same as above. + --custom-plist Optionally change the input plist. + --master-plist Same as above. --output-bootdisk Optionally change the bootdisk filename --output-plist Optionally change the output plist filename --help, -h, help Display this help and exit @@ -65,6 +66,7 @@ while (( "$#" )); do export DEVICE_MODEL="${1#*=}" shift ;; + --model* | -m* ) export DEVICE_MODEL="${2}" shift @@ -75,6 +77,7 @@ while (( "$#" )); do export SERIAL="${1#*=}" shift ;; + --serial* ) export SERIAL="${2}" shift @@ -85,6 +88,7 @@ while (( "$#" )); do export BOARD_SERIAL="${1#*=}" shift ;; + --board-serial* ) export BOARD_SERIAL="${2}" shift @@ -95,6 +99,7 @@ while (( "$#" )); do export UUID="${1#*=}" shift ;; + --uuid* ) export UUID="${2}" shift @@ -105,6 +110,7 @@ while (( "$#" )); do export MAC_ADDRESS="${1#*=}" shift ;; + --mac-address* ) export MAC_ADDRESS="${2}" shift @@ -115,6 +121,7 @@ while (( "$#" )); do export WIDTH="${1#*=}" shift ;; + --width* ) export WIDTH="${2}" shift @@ -125,6 +132,7 @@ while (( "$#" )); do export HEIGHT="${1#*=}" shift ;; + --height* ) export HEIGHT="${2}" shift @@ -135,6 +143,7 @@ while (( "$#" )); do export OUTPUT_QCOW="${1#*=}" shift ;; + --output-bootdisk* ) export OUTPUT_QCOW="${2}" shift @@ -145,38 +154,30 @@ while (( "$#" )); do export OUTPUT_PLIST="${1#*=}" shift ;; + --output-plist* ) export OUTPUT_PLIST="${2}" shift shift ;; - --master-plist-url=* ) + --master-plist-url=* | --input-plist-url=* | --custom-plist-url=* ) export MASTER_PLIST_URL="${1#*=}" shift ;; - - --master-plist-url* ) + + --master-plist-url* | --input-plist-url* | --custom-plist-url* ) export MASTER_PLIST_URL="${2}" shift shift ;; - --master-plist=* ) + --master-plist=* | --input-plist=* | --custom-plist=* ) export MASTER_PLIST="${1#*=}" shift ;; - --master-plist* ) - export MASTER_PLIST="${2}" - shift - shift - ;; - --custom-plist=* ) - export MASTER_PLIST="${1#*=}" - shift - ;; - --custom-plist* ) + --master-plist* | --input-plist* | --custom-plist* ) export MASTER_PLIST="${2}" shift shift diff --git a/generate-unique-machine-values.sh b/generate-unique-machine-values.sh index c1bdda9..c5def1b 100755 --- a/generate-unique-machine-values.sh +++ b/generate-unique-machine-values.sh @@ -22,13 +22,14 @@ General options: --output-dir Optionally change the script output location --width Resolution x axis length in px, default 1920 --height Resolution y axis length in px, default 1080 - --master-plist-url Specify an alternative master plist, via URL - --master-plist Optionally change the input plist - --custom-plist Same as --master-plist + --input-plist-url Specify an alternative master plist, via URL + --master-plist-url Same as above. + --custom-plist Optionally change the input plist. + --master-plist Same as above. --output-bootdisk Optionally change the bootdisk filename - --envs Create all corresponding sourcable envs - --plists Create all corresponding config.plists - --bootdisks Create all corresponding bootdisks [SLOW] + --create-envs, --envs Create all corresponding sourcable envs + --create-plists, --plists Create all corresponding config.plists + --create-bootdisks, --bootdisks Create all corresponding bootdisks [SLOW] --help, -h, help Display this help and exit Additional options only if you are creating ONE serial set: @@ -70,6 +71,7 @@ while (( "$#" )); do export SERIAL_SET_COUNT="${1#*=}" shift ;; + --count* | -c* | -n* ) export SERIAL_SET_COUNT="${2}" shift @@ -80,6 +82,7 @@ while (( "$#" )); do export CSV_OUTPUT_FILENAME="${1#*=}" shift ;; + --csv* ) export CSV_OUTPUT_FILENAME="${2}" shift @@ -90,6 +93,7 @@ while (( "$#" )); do export TSV_OUTPUT_FILENAME="${1#*=}" shift ;; + --tsv* ) export TSV_OUTPUT_FILENAME="${2}" shift @@ -100,6 +104,7 @@ while (( "$#" )); do export OUTPUT_DIRECTORY="${1#*=}" shift ;; + --output-dir* ) export OUTPUT_DIRECTORY="${2}" shift @@ -110,6 +115,7 @@ while (( "$#" )); do export OUTPUT_BOOTDISK="${1#*=}" shift ;; + --output-bootdisk* ) export OUTPUT_BOOTDISK="${2}" shift @@ -120,6 +126,7 @@ while (( "$#" )); do export OUTPUT_ENV="${1#*=}" shift ;; + --output-env* ) export OUTPUT_ENV="${2}" shift @@ -130,6 +137,7 @@ while (( "$#" )); do export DEVICE_MODEL="${1#*=}" shift ;; + --model* | -m* ) export DEVICE_MODEL="${2}" shift @@ -151,54 +159,46 @@ while (( "$#" )); do export HEIGHT="${1#*=}" shift ;; + --height* ) export HEIGHT="${2}" shift shift ;; - --master-plist-url=* ) + --master-plist-url=* | --input-plist-url=* | --custom-plist-url=* ) export MASTER_PLIST_URL="${1#*=}" shift ;; - - --master-plist-url* ) + + --master-plist-url* | --input-plist-url* | --custom-plist-url* ) export MASTER_PLIST_URL="${2}" shift shift ;; - --master-plist=* ) + --master-plist=* | --input-plist=* | --custom-plist=* ) export MASTER_PLIST="${1#*=}" shift ;; - --master-plist* ) + --master-plist* | --input-plist* | --custom-plist* ) export MASTER_PLIST="${2}" shift shift ;; - --custom-plist=* ) - export MASTER_PLIST="${1#*=}" - shift - ;; - - --custom-plist* ) - export MASTER_PLIST="${2}" - shift - shift - ;; - - --plists ) + --create-plists | --plists ) export CREATE_PLISTS=1 shift ;; - --bootdisks ) + + --create-bootdisks | --bootdisks ) export CREATE_BOOTDISKS=1 shift ;; - --envs ) + + --create-envs | --envs ) export CREATE_ENVS=1 shift ;;