代码拉取完成,页面将自动刷新
#!/bin/bash
#
# @script provision.sh
# @description provisioning script that builds environment for
# https://github.com/solo-io/packer-builder-arm-image
#
# By default, sets up environment, builds the plugin, and image
##
set -x
set -e
# Set to false to disable auto building
export PACKERFILE=${PACKERFILE:-samples/raspbian_golang.json}
PLUGIN_DIR=${PLUGIN_DIR:-/root/.packer.d/plugins}
sudo mkdir -p $PLUGIN_DIR
sudo cp /vagrant/packer-builder-arm-image "$PLUGIN_DIR/"
# Now build the image
if sudo [[ ! -f "$PLUGIN_DIR/packer-builder-arm-image" ]]; then {
echo "Error: Plugin not found. Retry build."
exit
} else {
echo "Attempting to build image"
PACKER_LOG=$(mktemp)
# If there is a custom json, try that one
# otherwise go with the default
if [[ -f /vagrant/${PACKERFILE} ]]; then {
sudo packer build /vagrant/${PACKERFILE} | tee ${PACKER_LOG}
} else {
if [[ -f $GOPATH/src/github.com/solo-io/packer-builder-arm-image/${PACKERFILE} ]]; then {
sudo packer build $GOPATH/src/github.com/solo-io/packer-builder-arm-image/${PACKERFILE} | tee ${PACKER_LOG}
} else {
echo "Error: packer build definition ${PACKERFILE} not found."
exit
}; fi
}; fi
BUILD_NAME=$(grep -Po "(?<=Build ').*(?=' finished.)" ${PACKER_LOG})
IMAGE_PATH=$(grep -Po "(?<=--> ${BUILD_NAME}: ).*" ${PACKER_LOG})
rm -f ${PACKER_LOG}
# If the new image is there, copy it out or throw an error
if [[ -f ${HOME}/${IMAGE_PATH} ]]; then {
sudo cp ${HOME}/${IMAGE_PATH} \
/vagrant/${IMAGE_PATH%/image}.img
} else {
echo "Error: Unable to find build artifact."
exit
}; fi
}; fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。