Initial import.

This commit is contained in:
2023-04-09 18:31:44 -07:00
commit 6df60caedc
6 changed files with 122 additions and 0 deletions

7
packer/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
# Set up a packer image in Docker.
FROM ubuntu:22.04
MAINTAINER Kyle Isom <kyle@imap.cc>
add . packer
ENTRYPOINT ["/usr/bin/env", "bash"]

9
packer/README.md Normal file
View File

@@ -0,0 +1,9 @@
# bladerunner/packer
This directory contains the tooling to build raspberry pi images using
packer.
### Resources
- [Build a Raspberry Pi image with Packer](https://linuxhit.com/build-a-raspberry-pi-image-packer-packer-builder-arm/)

50
packer/install-packer.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -eux
PACKER_VERSION=1.8.6
INSTALL_DIR=/usr/local/bin
ARCH=amd64
PACKER_FILE=packer_${PACKER_VERSION}_linux_${ARCH}
UPSTREAM="https://github.com/mkaczanowski/packer-builder-arm"
UPGRADE="false"
prep () {
mkdir -p build
pushd build
}
install_packer () {
if [ -x ${INSTALL_DIR}/packer ]
then
return 0
fi
curl -LO https://releases.hashicorp.com/packer/${PACKER_VERSION}/${PACKER_FILE}.zip
unzip ${PACKER_FILE}
sudo mv packer ${INSTALL_DIR}/
rm ${PACKER_FILE}.zip
}
install_packer_builder_arm () {
if [ -x "${INSTALL_DIR}/packer-builder-arm" -a -z "${UPGRADE}" ]
then
return 0
fi
git clone "${UPSTREAM}"
pushd "${UPSTREAM##*/}"
go mod download
go build
sudo mv packer-builder-arm ${INSTALL_DIR}/
popd
}
cleanup {
popd
}
prep
install_packer
install_packer_builder_arm
cleanup