packer: update boards and base images.
The base images make sure to remove snapd and fake-hwclock, as well as using installing the rng-tools package.
This commit is contained in:
parent
d44b20977b
commit
581b3972d1
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"variables": {},
|
||||
"builders": [
|
||||
{
|
||||
"type": "arm",
|
||||
"file_urls": [
|
||||
"build/ubuntu-22.04.2-preinstalled-server-arm64+raspi.img.xz",
|
||||
"https://cdimage.ubuntu.com/releases/22.04.2/release/ubuntu-22.04.2-preinstalled-server-arm64+raspi.img.xz"
|
||||
],
|
||||
"file_checksum_url": "http://cdimage.ubuntu.com/releases/22.04.2/release/SHA256SUMS",
|
||||
"file_checksum_type": "sha256",
|
||||
"file_target_extension": "xz",
|
||||
"file_unarchive_cmd": [
|
||||
"xz",
|
||||
"--decompress",
|
||||
"$ARCHIVE_PATH"
|
||||
],
|
||||
"image_build_method": "reuse",
|
||||
"image_path": "build/cm4-cdev-ubuntu-22.04.2.img",
|
||||
"image_size": "32G",
|
||||
"image_type": "dos",
|
||||
"image_partitions": [
|
||||
{
|
||||
"name": "boot",
|
||||
"type": "c",
|
||||
"start_sector": 2048,
|
||||
"size": "256M",
|
||||
"mountpoint": "/boot/firmware"
|
||||
},
|
||||
{
|
||||
"name": "root",
|
||||
"type": "83",
|
||||
"start_sector": 526336,
|
||||
"size": "31.7G",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
],
|
||||
"image_chroot_env": [
|
||||
"PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
|
||||
],
|
||||
"qemu_binary_source_path": "/usr/bin/qemu-aarch64-static",
|
||||
"qemu_binary_destination_path": "/usr/bin/qemu-aarch64-static"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"destination": "/boot/firmware/user-data",
|
||||
"source": "files/user-data",
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"scripts": [
|
||||
"scripts/install-base.sh",
|
||||
"scripts/setup-ssh.sh",
|
||||
"scripts/setup-cdev.sh"
|
||||
],
|
||||
"type": "shell"
|
||||
}
|
||||
],
|
||||
"post-processors": null
|
||||
}
|
|
@ -18,33 +18,24 @@ errmsg () {
|
|||
echo "$@" > /dev/stderr
|
||||
}
|
||||
|
||||
IMAGE_TYPE="${1:-ubuntu}"
|
||||
IMAGE_TYPE="${1:-cnode}"
|
||||
|
||||
preflight () {
|
||||
case "${IMAGE_TYPE}" in
|
||||
ubuntu)
|
||||
PACKER_BUILD_FILE="boards/cm4-cluster-ubuntu-22.04.2.json"
|
||||
if [ "${SKIP_LOCAL_CACHE}" != "yes" ]
|
||||
then
|
||||
REMOTE_IMAGE_URL="$(jq '.builders[0].file_urls' ${PACKER_BUILD_FILE} | grep https | tr -d ' \",')"
|
||||
fi
|
||||
;;
|
||||
cdev) PACKER_BUILD_FILE="boards/cm4-cdev-ubuntu-22.04.2.json" ;;
|
||||
cnode) PACKER_BUILD_FILE="cm4-cluster-ubuntu-22.04.2.img" ;;
|
||||
custom)
|
||||
if [ -z "${PACKER_BUILD_FILE}" ]
|
||||
then
|
||||
errmsg "[!] custom board requires a board file path"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${SKIP_LOCAL_CACHE}" != "yes" ]
|
||||
then
|
||||
REMOTE_IMAGE_URL="$(jq '.builders[0].file_urls' ${PACKER_BUILD_FILE} | grep https | tr -d ' \",')"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
errmsg "[!] invalid image type ${IMAGE_TYPE}."
|
||||
errmsg "[!] valid image types are"
|
||||
errmsg " - ubuntu"
|
||||
errmsg " - cdev"
|
||||
errmsg " - cnode"
|
||||
errmsg " - custom path/to/board/file"
|
||||
exit 1
|
||||
;;
|
||||
|
@ -58,6 +49,7 @@ cache_remote_url () {
|
|||
return 0
|
||||
fi
|
||||
|
||||
local REMOTE_IMAGE_URL="$(jq '.builders[0].file_urls' ${PACKER_BUILD_FILE} | grep https | tr -d ' \",')"
|
||||
local CACHED_FILE="$(jq '.builders[0].file_urls' ${PACKER_BUILD_FILE} | grep -v https | grep \" | tr -d ' \",')"
|
||||
if [ -z "${CACHED_FILE}" ]
|
||||
then
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
#cloud-config
|
||||
|
||||
# This is the user-data configuration file for cloud-init. By default this sets
|
||||
# up an initial user called "ubuntu" with password "ubuntu", which must be
|
||||
# changed at first login. However, many additional actions can be initiated on
|
||||
# first boot from this file. The cloud-init documentation has more details:
|
||||
#
|
||||
# https://cloudinit.readthedocs.io/
|
||||
# NOTE: this is a dev-environment fixture where I want a known user:pass to
|
||||
# login on the serial console if things go sideways.
|
||||
chpasswd:
|
||||
expire: false
|
||||
list:
|
||||
- ubuntu:ubuntu
|
||||
- name: ubuntu
|
||||
password: ubuntu
|
||||
type: text
|
||||
|
||||
hostname: rp3b-cdev
|
||||
ssh_pwauth: true
|
||||
|
@ -48,4 +46,11 @@ network:
|
|||
ethernets:
|
||||
eth0:
|
||||
dhcp4: yes
|
||||
|
||||
dhcp6: yes
|
||||
eth1:
|
||||
dhcp4: no
|
||||
dhcp6: no
|
||||
addresses:
|
||||
"192.168.4.64/24"
|
||||
label: "cluster"
|
||||
lifetime: forever
|
||||
|
|
|
@ -8,5 +8,7 @@ echo 'nameserver 8.8.8.8' > /etc/resolv.conf
|
|||
|
||||
echo "==> installing base updates"
|
||||
apt-get -y update
|
||||
apt-get -y install ansible apt-transport-https ca-certificates wpasupplicant
|
||||
apt-get -y clean
|
||||
apt-get -y install ansible apt-transport-https ca-certificates rng-tools
|
||||
apt-get -y remove fake-hwclock snapd
|
||||
apt-get -y clean
|
||||
apt-get -y autoremove
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
set -euxo pipefail
|
||||
|
||||
sudo apt-get -y install picocom wpasupplicant
|
||||
apt-get -y install picocom wpasupplicant
|
|
@ -10,10 +10,11 @@ boards:
|
|||
- scripts/setup-ssh.sh
|
||||
- version: 22.04.2
|
||||
size: 32G
|
||||
name: rp4-cdev-ubuntu-22.04.2.img
|
||||
name: cm4-cdev-ubuntu-22.04.2.img
|
||||
files:
|
||||
- source: files/user-data
|
||||
destination: /boot/firmware/user-data
|
||||
scripts:
|
||||
- scripts/install-base.sh
|
||||
- scripts/setup-ssh.sh
|
||||
- scripts/setup-cdev.sh
|
||||
|
|
Loading…
Reference in New Issue