forked from appveyor/build-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
macbuild.sh
executable file
·30 lines (22 loc) · 958 Bytes
/
macbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash -x
function build_vm() {
MACOS_VER=$1
OUT_DIR="./output-parallels-pvm"
PACKER_CONFIG="$HOME/${MACOS_VER}-packer-config.json"
PACKER_LOGS="$HOME/packer-logs"
[ -d "${OUT_DIR}" ] && rm -rf "${OUT_DIR}"
mkdir -p "${PACKER_LOGS}"
if [[ -z "${DATEMARK-}" || "${#DATEMARK}" = "0" ]]; then DATEMARK=$(date +%Y%m%d%H%M%S); fi
[ -f "${PACKER_CONFIG}" ] || { echo "File '${PACKER_CONFIG}' does not exist. Aborting"; return; }
export PACKER_LOG_PATH="${PACKER_LOGS}/${MACOS_VER}-${DATEMARK}.log"
PACKER_LOG=1 packer build --only=parallels-pvm "-var-file=${PACKER_CONFIG}" \
-var "datemark=${DATEMARK}" \
macos.json
[ -d "${OUT_DIR}" ] && {
mv -fv $OUT_DIR/packer-${MACOS_VER}-*.pvm "$HOME/Parallels/" &&
prlctl register $HOME/Parallels/packer-${MACOS_VER}-*.pvm ||
{ echo "failed to copy PVM. Aborting"; exit 1; }
}
}
#build_vm "catalina"
build_vm "mojave"