Simplify options. Make inputy/master/custom plist all the same option.

This commit is contained in:
sickcodes 2021-03-08 13:38:52 +00:00
parent fad6722051
commit 15475ee818
3 changed files with 65 additions and 47 deletions

View file

@ -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

View file

@ -24,9 +24,10 @@ Required options:
Optional options:
--width <integer> Resolution x axis length in px, default 1920
--height <integer> Resolution y axis length in px, default 1080
--master-plist-url <url> Specify an alternative master plist, via URL
--custom-plist <filename>
|| --master-plist <filename> Optionally change the input plist.
--input-plist-url <url> Specify an alternative master plist, via URL
--master-plist-url <url> Same as above.
--custom-plist <filename> Optionally change the input plist.
--master-plist <filename> Same as above.
--output-bootdisk <filename> Optionally change the bootdisk filename
--output-plist <filename> 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

View file

@ -22,13 +22,14 @@ General options:
--output-dir <directory> Optionally change the script output location
--width <string> Resolution x axis length in px, default 1920
--height <string> Resolution y axis length in px, default 1080
--master-plist-url <url> Specify an alternative master plist, via URL
--master-plist <filename> Optionally change the input plist
--custom-plist <filename> Same as --master-plist
--input-plist-url <url> Specify an alternative master plist, via URL
--master-plist-url <url> Same as above.
--custom-plist <filename> Optionally change the input plist.
--master-plist <filename> Same as above.
--output-bootdisk <filename> 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
;;