-
Notifications
You must be signed in to change notification settings - Fork 4
/
packer.sh
executable file
·35 lines (29 loc) · 946 Bytes
/
packer.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
31
32
33
34
35
#!/usr/bin/env bash
#
# Vagrant Windows box factory
#
# @author Luke Carrier <[email protected]>
# @copyright 2015 Luke Carrier
# @license GPL v3
#
set -euo pipefail
shopt -s nullglob
PARALLELS_FRAMEWORK="/Library/Frameworks/ParallelsVirtualizationSDK.framework/Versions/Current/Libraries/Python"
if [[ "$OSTYPE" == "darwin"* ]] && [[ -d "$PARALLELS_FRAMEWORK" ]]; then
echo 'Putting Parallels Python SDK on PYTHONPATH'
export PYTHONPATH="$(echo "$PARALLELS_FRAMEWORK"/3.*)"
fi
ROOT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
BUILD_DIR="${ROOT_DIR}/builds"
export PACKER_BUILD_DIR="$(mktemp -d "${BUILD_DIR}/bld.XXXXXXXX")"
export PACKER_CACHE_DIR="${ROOT_DIR}/cache"
echo "Building in ${PACKER_BUILD_DIR} using cache ${PACKER_CACHE_DIR}..."
ARGS=( $@ )
for i in ${!ARGS[@]}; do
if [ -f "${ARGS[$i]}" ]; then
ARGS[$i]="$(realpath "${ARGS[$i]}")"
fi
done
pushd "$PACKER_BUILD_DIR" >/dev/null
packer ${ARGS[@]} || true
popd >/dev/null