From 220b38c46d2857d8708ab45202587b8bb183648d Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Wed, 12 Apr 2023 12:51:41 -0700 Subject: [PATCH] minor fixups --- gazelle.sh | 12 +++++ packer/boards/cm4-cluster-ubuntu-22.04.2.json | 54 +++++++++++++++++++ packer/packerlib/ubuntu_test.go | 16 ++++++ 3 files changed, 82 insertions(+) create mode 100755 gazelle.sh create mode 100644 packer/boards/cm4-cluster-ubuntu-22.04.2.json create mode 100644 packer/packerlib/ubuntu_test.go diff --git a/gazelle.sh b/gazelle.sh new file mode 100755 index 0000000..7bff6f8 --- /dev/null +++ b/gazelle.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +BAZEL="bazel" +if [ -z "$(command -v ${BAZEL})" ] +then + BAZEL="bazelisk" +fi + +$BAZEL run //:gazelle +$BAZEL run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies +$BAZEL run //:gazelle + diff --git a/packer/boards/cm4-cluster-ubuntu-22.04.2.json b/packer/boards/cm4-cluster-ubuntu-22.04.2.json new file mode 100644 index 0000000..72a52de --- /dev/null +++ b/packer/boards/cm4-cluster-ubuntu-22.04.2.json @@ -0,0 +1,54 @@ +{ + "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-cluster-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": [ + { + "scripts": [ + "scripts/install-base.sh" + ], + "type": "shell" + } + ], + "post-processors": null +} \ No newline at end of file diff --git a/packer/packerlib/ubuntu_test.go b/packer/packerlib/ubuntu_test.go new file mode 100644 index 0000000..85cbe66 --- /dev/null +++ b/packer/packerlib/ubuntu_test.go @@ -0,0 +1,16 @@ +package packerlib + +import "testing" + +func TestJSONPath(t *testing.T) { + baseName := "cm4-cluster-ubuntu-22.04.2" + spec := UbuntuBoardSpec{ + ImageName: "cm4-cluster-ubuntu-22.04.2" + ".img", + } + + outPath := spec.JSONPath("") + expected := baseName + ".json" + if outPath != expected { + t.Fatalf("bad JSON path name: have %s, expect %s", outPath, expected) + } +}