mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2024-11-23 10:44:09 +08:00
Add --output-env <filename> && --output-bootdisk <filename>
This commit is contained in:
parent
246fd12c18
commit
7886e0fd06
25
README.md
25
README.md
@ -499,30 +499,7 @@ sudo mv somedir/mac_hdd_ng.img .
|
|||||||
|
|
||||||
# Use an Old Docker-OSX Disk in a Fresh Container (Replication)
|
# Use an Old Docker-OSX Disk in a Fresh Container (Replication)
|
||||||
|
|
||||||
You do not have to reinstall everything, you can simply:
|
[Use the sickcodes/docker-osx:naked image.](https://github.com/sickcodes/Docker-OSX/tree/custom-identity#quick-start-own-image)
|
||||||
|
|
||||||
- start a new container
|
|
||||||
|
|
||||||
- overwrite the .img in the new container with your big old one
|
|
||||||
|
|
||||||
```bash
|
|
||||||
|
|
||||||
# start a new docker-osx container
|
|
||||||
# you can start with ssh, without, or vnc, because they are all interchangable.
|
|
||||||
|
|
||||||
# get the NEW container id
|
|
||||||
docker ps
|
|
||||||
|
|
||||||
# docker cp your OLD disk into the NEW container
|
|
||||||
docker cp ./mac_hdd_ng.img newcontainerid:/home/arch/OSX-KVM/mac_hdd_ng.img
|
|
||||||
|
|
||||||
# kill the NEW container
|
|
||||||
docker kill newcontainerid
|
|
||||||
|
|
||||||
# start the NEW container and it just works
|
|
||||||
docker start newcontainerid
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
# DESTROY: Wipe old images to free disk space
|
# DESTROY: Wipe old images to free disk space
|
||||||
|
|
||||||
|
@ -18,14 +18,16 @@ General options:
|
|||||||
--model, -m <model> Device model, e.g. 'iMacPro1,1'
|
--model, -m <model> Device model, e.g. 'iMacPro1,1'
|
||||||
--csv <filename> Optionally change the CSV output filename.
|
--csv <filename> Optionally change the CSV output filename.
|
||||||
--tsv <filename> Optionally change the TSV output filename.
|
--tsv <filename> Optionally change the TSV output filename.
|
||||||
|
--output-bootdisk <filename> Optionally change the bootdisk qcow output filename. Useless when count > 1.
|
||||||
|
--output-env <filename> Optionally change the bootdisk env filename. Useless when count > 1.
|
||||||
--output-dir <directory> Optionally change the script output location.
|
--output-dir <directory> Optionally change the script output location.
|
||||||
|
|
||||||
--help, -h, help Display this help and exit
|
--help, -h, help Display this help and exit
|
||||||
--plists Create corresponding config.plists for each serial set.
|
--plists Create corresponding config.plists for each serial set.
|
||||||
--qcows [SLOW] Create corresponding boot disk images for each serial set.
|
--bootdisks [SLOW] Create corresponding boot disk images for each serial set.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
./generate-unique-machine-values.sh --count 1 --model='iMacPro1,1' --plists --qcows
|
./generate-unique-machine-values.sh --count 1 --model='iMacPro1,1' --plists --bootdisks
|
||||||
|
|
||||||
The above example will generate a
|
The above example will generate a
|
||||||
- serial
|
- serial
|
||||||
@ -100,6 +102,26 @@ while (( "$#" )); do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--output-bootdisk=* )
|
||||||
|
export OUTPUT_QCOW="${1#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--output-bootdisk* )
|
||||||
|
export OUTPUT_QCOW="${2}"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
--output-env=* )
|
||||||
|
export OUTPUT_ENV="${1#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--output-env* )
|
||||||
|
export OUTPUT_ENV="${2}"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
--model=* | -m=* )
|
--model=* | -m=* )
|
||||||
export DEVICE_MODEL="${1#*=}"
|
export DEVICE_MODEL="${1#*=}"
|
||||||
shift
|
shift
|
||||||
@ -114,7 +136,7 @@ while (( "$#" )); do
|
|||||||
export CREATE_PLISTS=1
|
export CREATE_PLISTS=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--qcows )
|
--bootdisks )
|
||||||
export CREATE_QCOWS=1
|
export CREATE_QCOWS=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
@ -199,8 +221,9 @@ generate_serial_sets () {
|
|||||||
printf "${DEVICE_MODEL}\t${Serial}\t${BoardSerial}\t${SmUUID}\t${MacAddress}\n" >> "${TSV_SERIAL_SETS_FILE}"
|
printf "${DEVICE_MODEL}\t${Serial}\t${BoardSerial}\t${SmUUID}\t${MacAddress}\n" >> "${TSV_SERIAL_SETS_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch "${OUTPUT_DIRECTORY}/envs/${Serial}.env.sh"
|
OUTPUT_ENV_FILE="${OUTPUT_ENV:-"${OUTPUT_DIRECTORY}/envs/${Serial}.env.sh"}"
|
||||||
cat <<EOF > "${OUTPUT_DIRECTORY}/envs/${Serial}.env.sh"
|
touch "${OUTPUT_ENV_FILE}"
|
||||||
|
cat <<EOF > "${OUTPUT_ENV_FILE}"
|
||||||
export Type=${DEVICE_MODEL}
|
export Type=${DEVICE_MODEL}
|
||||||
export Serial=${Serial}
|
export Serial=${Serial}
|
||||||
export BoardSerial=${BoardSerial}
|
export BoardSerial=${BoardSerial}
|
||||||
@ -208,10 +231,10 @@ export SmUUID=${SmUUID}
|
|||||||
export MacAddress=${MacAddress}
|
export MacAddress=${MacAddress}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# plist required for qcows, so create anyway.
|
# plist required for bootdisks, so create anyway.
|
||||||
if [[ "${CREATE_PLISTS}" ]] || [[ "${CREATE_QCOWS}" ]]; then
|
if [[ "${CREATE_PLISTS}" ]] || [[ "${CREATE_QCOWS}" ]]; then
|
||||||
mkdir -p "${OUTPUT_DIRECTORY}/plists"
|
mkdir -p "${OUTPUT_DIRECTORY}/plists"
|
||||||
source "${OUTPUT_DIRECTORY}/envs/${Serial}.env.sh"
|
source "${OUTPUT_ENV_FILE}"
|
||||||
ROM_VALUE="${MacAddress//\:/}"
|
ROM_VALUE="${MacAddress//\:/}"
|
||||||
ROM_VALUE="${ROM_VALUE,,}"
|
ROM_VALUE="${ROM_VALUE,,}"
|
||||||
sed -e s/{{DEVICE_MODEL}}/"${Type}"/g \
|
sed -e s/{{DEVICE_MODEL}}/"${Type}"/g \
|
||||||
@ -226,7 +249,7 @@ EOF
|
|||||||
mkdir -p "${OUTPUT_DIRECTORY}/qcows"
|
mkdir -p "${OUTPUT_DIRECTORY}/qcows"
|
||||||
./opencore-image-ng.sh \
|
./opencore-image-ng.sh \
|
||||||
--cfg "${OUTPUT_DIRECTORY}/plists/${Serial}.config.plist" \
|
--cfg "${OUTPUT_DIRECTORY}/plists/${Serial}.config.plist" \
|
||||||
--img "${OUTPUT_DIRECTORY}/qcows/${Serial}.OpenCore-nopicker.qcow2" || exit 1
|
--img "${OUTPUT_QCOW:-${OUTPUT_DIRECTORY}/qcows/${Serial}.OpenCore-nopicker.qcow2}" || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user