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 # 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. 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 ```bash
# Ubuntu/Debian/Pop # 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 # Fedora, RHEL, CentOS
sudo yum install libguestfs wget git -y sudo yum install libguestfs wget git -y
@ -53,13 +53,28 @@ sudo pacman -Sy libguestfs wget git base-devel
# Generating New Unique Serial Numbers # Generating New Unique Serial Numbers
Example 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 # make 100 serial sets
./generate-unique-machine-values.sh -c 100 --model="iMacPro1,1" ./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. # 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 ./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 ./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: Or you can manually enter the values generated above:
```xml ```xml

View file

@ -24,9 +24,10 @@ Required options:
Optional options: Optional options:
--width <integer> Resolution x axis length in px, default 1920 --width <integer> Resolution x axis length in px, default 1920
--height <integer> Resolution y axis length in px, default 1080 --height <integer> Resolution y axis length in px, default 1080
--master-plist-url <url> Specify an alternative master plist, via URL --input-plist-url <url> Specify an alternative master plist, via URL
--custom-plist <filename> --master-plist-url <url> Same as above.
|| --master-plist <filename> Optionally change the input plist. --custom-plist <filename> Optionally change the input plist.
--master-plist <filename> Same as above.
--output-bootdisk <filename> Optionally change the bootdisk filename --output-bootdisk <filename> Optionally change the bootdisk filename
--output-plist <filename> Optionally change the output plist filename --output-plist <filename> Optionally change the output plist filename
--help, -h, help Display this help and exit --help, -h, help Display this help and exit
@ -65,6 +66,7 @@ while (( "$#" )); do
export DEVICE_MODEL="${1#*=}" export DEVICE_MODEL="${1#*=}"
shift shift
;; ;;
--model* | -m* ) --model* | -m* )
export DEVICE_MODEL="${2}" export DEVICE_MODEL="${2}"
shift shift
@ -75,6 +77,7 @@ while (( "$#" )); do
export SERIAL="${1#*=}" export SERIAL="${1#*=}"
shift shift
;; ;;
--serial* ) --serial* )
export SERIAL="${2}" export SERIAL="${2}"
shift shift
@ -85,6 +88,7 @@ while (( "$#" )); do
export BOARD_SERIAL="${1#*=}" export BOARD_SERIAL="${1#*=}"
shift shift
;; ;;
--board-serial* ) --board-serial* )
export BOARD_SERIAL="${2}" export BOARD_SERIAL="${2}"
shift shift
@ -95,6 +99,7 @@ while (( "$#" )); do
export UUID="${1#*=}" export UUID="${1#*=}"
shift shift
;; ;;
--uuid* ) --uuid* )
export UUID="${2}" export UUID="${2}"
shift shift
@ -105,6 +110,7 @@ while (( "$#" )); do
export MAC_ADDRESS="${1#*=}" export MAC_ADDRESS="${1#*=}"
shift shift
;; ;;
--mac-address* ) --mac-address* )
export MAC_ADDRESS="${2}" export MAC_ADDRESS="${2}"
shift shift
@ -115,6 +121,7 @@ while (( "$#" )); do
export WIDTH="${1#*=}" export WIDTH="${1#*=}"
shift shift
;; ;;
--width* ) --width* )
export WIDTH="${2}" export WIDTH="${2}"
shift shift
@ -125,6 +132,7 @@ while (( "$#" )); do
export HEIGHT="${1#*=}" export HEIGHT="${1#*=}"
shift shift
;; ;;
--height* ) --height* )
export HEIGHT="${2}" export HEIGHT="${2}"
shift shift
@ -135,6 +143,7 @@ while (( "$#" )); do
export OUTPUT_QCOW="${1#*=}" export OUTPUT_QCOW="${1#*=}"
shift shift
;; ;;
--output-bootdisk* ) --output-bootdisk* )
export OUTPUT_QCOW="${2}" export OUTPUT_QCOW="${2}"
shift shift
@ -145,38 +154,30 @@ while (( "$#" )); do
export OUTPUT_PLIST="${1#*=}" export OUTPUT_PLIST="${1#*=}"
shift shift
;; ;;
--output-plist* ) --output-plist* )
export OUTPUT_PLIST="${2}" export OUTPUT_PLIST="${2}"
shift shift
shift shift
;; ;;
--master-plist-url=* ) --master-plist-url=* | --input-plist-url=* | --custom-plist-url=* )
export MASTER_PLIST_URL="${1#*=}" export MASTER_PLIST_URL="${1#*=}"
shift shift
;; ;;
--master-plist-url* ) --master-plist-url* | --input-plist-url* | --custom-plist-url* )
export MASTER_PLIST_URL="${2}" export MASTER_PLIST_URL="${2}"
shift shift
shift shift
;; ;;
--master-plist=* ) --master-plist=* | --input-plist=* | --custom-plist=* )
export MASTER_PLIST="${1#*=}" export MASTER_PLIST="${1#*=}"
shift shift
;; ;;
--master-plist* )
export MASTER_PLIST="${2}"
shift
shift
;;
--custom-plist=* ) --master-plist* | --input-plist* | --custom-plist* )
export MASTER_PLIST="${1#*=}"
shift
;;
--custom-plist* )
export MASTER_PLIST="${2}" export MASTER_PLIST="${2}"
shift shift
shift shift

View file

@ -22,13 +22,14 @@ General options:
--output-dir <directory> Optionally change the script output location --output-dir <directory> Optionally change the script output location
--width <string> Resolution x axis length in px, default 1920 --width <string> Resolution x axis length in px, default 1920
--height <string> Resolution y axis length in px, default 1080 --height <string> Resolution y axis length in px, default 1080
--master-plist-url <url> Specify an alternative master plist, via URL --input-plist-url <url> Specify an alternative master plist, via URL
--master-plist <filename> Optionally change the input plist --master-plist-url <url> Same as above.
--custom-plist <filename> Same as --master-plist --custom-plist <filename> Optionally change the input plist.
--master-plist <filename> Same as above.
--output-bootdisk <filename> Optionally change the bootdisk filename --output-bootdisk <filename> Optionally change the bootdisk filename
--envs Create all corresponding sourcable envs --create-envs, --envs Create all corresponding sourcable envs
--plists Create all corresponding config.plists --create-plists, --plists Create all corresponding config.plists
--bootdisks Create all corresponding bootdisks [SLOW] --create-bootdisks, --bootdisks Create all corresponding bootdisks [SLOW]
--help, -h, help Display this help and exit --help, -h, help Display this help and exit
Additional options only if you are creating ONE serial set: Additional options only if you are creating ONE serial set:
@ -70,6 +71,7 @@ while (( "$#" )); do
export SERIAL_SET_COUNT="${1#*=}" export SERIAL_SET_COUNT="${1#*=}"
shift shift
;; ;;
--count* | -c* | -n* ) --count* | -c* | -n* )
export SERIAL_SET_COUNT="${2}" export SERIAL_SET_COUNT="${2}"
shift shift
@ -80,6 +82,7 @@ while (( "$#" )); do
export CSV_OUTPUT_FILENAME="${1#*=}" export CSV_OUTPUT_FILENAME="${1#*=}"
shift shift
;; ;;
--csv* ) --csv* )
export CSV_OUTPUT_FILENAME="${2}" export CSV_OUTPUT_FILENAME="${2}"
shift shift
@ -90,6 +93,7 @@ while (( "$#" )); do
export TSV_OUTPUT_FILENAME="${1#*=}" export TSV_OUTPUT_FILENAME="${1#*=}"
shift shift
;; ;;
--tsv* ) --tsv* )
export TSV_OUTPUT_FILENAME="${2}" export TSV_OUTPUT_FILENAME="${2}"
shift shift
@ -100,6 +104,7 @@ while (( "$#" )); do
export OUTPUT_DIRECTORY="${1#*=}" export OUTPUT_DIRECTORY="${1#*=}"
shift shift
;; ;;
--output-dir* ) --output-dir* )
export OUTPUT_DIRECTORY="${2}" export OUTPUT_DIRECTORY="${2}"
shift shift
@ -110,6 +115,7 @@ while (( "$#" )); do
export OUTPUT_BOOTDISK="${1#*=}" export OUTPUT_BOOTDISK="${1#*=}"
shift shift
;; ;;
--output-bootdisk* ) --output-bootdisk* )
export OUTPUT_BOOTDISK="${2}" export OUTPUT_BOOTDISK="${2}"
shift shift
@ -120,6 +126,7 @@ while (( "$#" )); do
export OUTPUT_ENV="${1#*=}" export OUTPUT_ENV="${1#*=}"
shift shift
;; ;;
--output-env* ) --output-env* )
export OUTPUT_ENV="${2}" export OUTPUT_ENV="${2}"
shift shift
@ -130,6 +137,7 @@ while (( "$#" )); do
export DEVICE_MODEL="${1#*=}" export DEVICE_MODEL="${1#*=}"
shift shift
;; ;;
--model* | -m* ) --model* | -m* )
export DEVICE_MODEL="${2}" export DEVICE_MODEL="${2}"
shift shift
@ -151,54 +159,46 @@ while (( "$#" )); do
export HEIGHT="${1#*=}" export HEIGHT="${1#*=}"
shift shift
;; ;;
--height* ) --height* )
export HEIGHT="${2}" export HEIGHT="${2}"
shift shift
shift shift
;; ;;
--master-plist-url=* ) --master-plist-url=* | --input-plist-url=* | --custom-plist-url=* )
export MASTER_PLIST_URL="${1#*=}" export MASTER_PLIST_URL="${1#*=}"
shift shift
;; ;;
--master-plist-url* ) --master-plist-url* | --input-plist-url* | --custom-plist-url* )
export MASTER_PLIST_URL="${2}" export MASTER_PLIST_URL="${2}"
shift shift
shift shift
;; ;;
--master-plist=* ) --master-plist=* | --input-plist=* | --custom-plist=* )
export MASTER_PLIST="${1#*=}" export MASTER_PLIST="${1#*=}"
shift shift
;; ;;
--master-plist* ) --master-plist* | --input-plist* | --custom-plist* )
export MASTER_PLIST="${2}" export MASTER_PLIST="${2}"
shift shift
shift shift
;; ;;
--custom-plist=* ) --create-plists | --plists )
export MASTER_PLIST="${1#*=}"
shift
;;
--custom-plist* )
export MASTER_PLIST="${2}"
shift
shift
;;
--plists )
export CREATE_PLISTS=1 export CREATE_PLISTS=1
shift shift
;; ;;
--bootdisks )
--create-bootdisks | --bootdisks )
export CREATE_BOOTDISKS=1 export CREATE_BOOTDISKS=1
shift shift
;; ;;
--envs )
--create-envs | --envs )
export CREATE_ENVS=1 export CREATE_ENVS=1
shift shift
;; ;;