packer/build-image: format and build as root
root is required for some of the build steps.
This commit is contained in:
parent
412cc5f22f
commit
a3403b0fc3
|
@ -10,29 +10,33 @@ errmsg () {
|
||||||
}
|
}
|
||||||
|
|
||||||
preflight () {
|
preflight () {
|
||||||
case "${IMAGE_TYPE}" in
|
case "${IMAGE_TYPE}" in
|
||||||
ubuntu) PACKER_BUILD_FILE="boards/raspberry-pi-4/ubuntu_server_20.04_arm64.json" ;;
|
ubuntu) PACKER_BUILD_FILE="boards/raspberry-pi-4/ubuntu_server_20.04_arm64.json" ;;
|
||||||
raspbian) PACKER_BUILD_FILE="boards/raspberry-pi/raspios-lite-arm.json" ;;
|
raspbian) PACKER_BUILD_FILE="boards/raspberry-pi/raspios-lite-arm.json" ;;
|
||||||
custom)
|
custom)
|
||||||
PACKER_BUILD_FILE="${2:-}"
|
PACKER_BUILD_FILE="${2:-}"
|
||||||
if [ -z "${PACKER_BUILD_FILE}" ]
|
if [ -z "${PACKER_BUILD_FILE}" ]
|
||||||
then
|
then
|
||||||
errmsg "[!] custom board requires a board file path"
|
errmsg "[!] custom board requires a board file path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
errmsg "[!] invalid image type ${IMAGE_TYPE}."
|
||||||
|
errmsg "[!] valid image types are"
|
||||||
|
errmsg " - raspbian"
|
||||||
|
errmsg " - ubuntu"
|
||||||
|
errmsg " - custom path/to/board/file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
;;
|
||||||
;;
|
|
||||||
*)
|
|
||||||
errmsg "[!] invalid image type ${IMAGE_TYPE}."
|
|
||||||
errmsg "[!] valid image types are"
|
|
||||||
errmsg " - raspbian"
|
|
||||||
errmsg " - ubuntu"
|
|
||||||
errmsg " - custom path/to/board/file"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
build_image () {
|
build_image () {
|
||||||
cd build/packer-builder-arm
|
cd build/packer-builder-arm
|
||||||
packer build ${PACKER_BUILD_FILE}
|
sudo packer build ${PACKER_BUILD_FILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preflight
|
||||||
|
build_image
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue