No functional change intended. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- host/initramfs/Makefile | 6 ++++-- host/rootfs/Makefile | 6 ++++-- release/live/Makefile | 6 ++++-- scripts/format-uuid.awk | 20 +++++++++++++++----- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile index e04e2ff471750410926f14099cee9786d582de86..392dcfc8af3d6924fae717025124f228a2362b94 100644 --- a/host/initramfs/Makefile +++ b/host/initramfs/Makefile @@ -36,9 +36,11 @@ build/mountpoints: find build/mountpoints -mindepth 1 -exec touch -d @0 {} ';' build/live.img: ../../scripts/format-uuid.awk ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk $(ROOT_FS_IMAGES) + uuids=$$(awk -f ../../scripts/format-uuid.awk < $(ROOT_FS_VERITY_ROOTHASH)) && \ + set -u -- $$uuids && \ bash ../../scripts/make-gpt.sh $@.tmp \ - $(ROOT_FS_VERITY):verity:$$(awk -f ../../scripts/format-uuid.awk "$$(dd if=$(ROOT_FS_VERITY_ROOTHASH) bs=32 skip=1 count=1 status=none)") \ - $(ROOT_FS_IMAGE):root:$$(awk -f ../../scripts/format-uuid.awk "$$(head -c 32 $(ROOT_FS_VERITY_ROOTHASH))") + $(ROOT_FS_VERITY):verity:$$2 \ + $(ROOT_FS_IMAGE):root:$$1 mv $@.tmp $@ build/loop.tar: build/live.img diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile index b2c0c6176fe0de4a99d1a3737d50054b532af598..ab24263c6f327e47cd1d012ca8d729b0ea5eb8f3 100644 --- a/host/rootfs/Makefile +++ b/host/rootfs/Makefile @@ -93,9 +93,11 @@ clean: .PHONY: clean build/live.img: ../../scripts/format-uuid.awk ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/verity-timestamp $(ROOT_FS_IMAGES) + uuids=$$(awk -f ../../scripts/format-uuid.awk < $(ROOT_FS_VERITY_ROOTHASH)) && \ + set -u -- $$uuids && \ bash ../../scripts/make-gpt.sh $@.tmp \ - $(ROOT_FS_VERITY):verity:$$(awk -f ../../scripts/format-uuid.awk "$$(dd if=$(ROOT_FS_VERITY_ROOTHASH) bs=32 skip=1 count=1 status=none)") \ - $(ROOT_FS_IMAGE):root:$$(awk -f ../../scripts/format-uuid.awk "$$(head -c 32 $(ROOT_FS_VERITY_ROOTHASH))") + $(ROOT_FS_VERITY):verity:$$2 \ + $(ROOT_FS_IMAGE):root:$$1 mv $@.tmp $@ debug: diff --git a/release/live/Makefile b/release/live/Makefile index 48df3ef4ad3faab4e0ad09380bd70dbdc980109f..5ab93451de109949af0e7ed7f70bf6827fefbf69 100644 --- a/release/live/Makefile +++ b/release/live/Makefile @@ -10,10 +10,12 @@ DTBS ?= build/empty dest = build/live.img $(dest): ../../scripts/format-uuid.awk ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/boot.fat $(ROOT_FS_IMAGES) + uuids=$$(awk -f ../../scripts/format-uuid.awk < $(ROOT_FS_VERITY_ROOTHASH)) && \ + set -u -- $$uuids && \ bash ../../scripts/make-gpt.sh $@.tmp \ build/boot.fat:c12a7328-f81f-11d2-ba4b-00a0c93ec93b \ - $(ROOT_FS_VERITY):verity:$$(awk -f ../../scripts/format-uuid.awk "$$(dd if=$(ROOT_FS_VERITY_ROOTHASH) bs=32 skip=1 count=1 status=none)") \ - $(ROOT_FS_IMAGE):root:$$(awk -f ../../scripts/format-uuid.awk "$$(head -c 32 $(ROOT_FS_VERITY_ROOTHASH))") + $(ROOT_FS_VERITY):verity:$$2 \ + $(ROOT_FS_IMAGE):root:$$1 mv $@.tmp $@ build/empty: diff --git a/scripts/format-uuid.awk b/scripts/format-uuid.awk index 17831221bbef2d2d038f4822b22f88939eab7437..d4c1a75d97ed86e17a118d8b2d3252cd78c77286 100644 --- a/scripts/format-uuid.awk +++ b/scripts/format-uuid.awk @@ -1,9 +1,19 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com> +function format_uuid(arg) { + print (substr(arg, 1, 8) "-" \ + substr(arg, 9, 4) "-" \ + substr(arg, 13, 4) "-" \ + substr(arg, 17, 4) "-" \ + substr(arg, 21, 12)); +} + BEGIN { - print (substr(ARGV[1], 1, 8) "-" \ - substr(ARGV[1], 9, 4) "-" \ - substr(ARGV[1], 13, 4) "-" \ - substr(ARGV[1], 17, 4) "-" \ - substr(ARGV[1], 21, 12)); + FS = ""; + if (getline != 1) { + print "Empty input file" > "/dev/stderr"; + exit 1; + } + format_uuid(substr($0, 1, 32)); + format_uuid(substr($0, 33, 32)); } -- 2.52.0