Re: [PATCH v3 04/14] scripts: port make-gpt.sh to bash

Demi Marie Obenour
2025-11-20T10:28:26Z

[-- Attachment #1.1.1: Type: text/plain, Size: 4721 bytes --]

On 11/19/25 03:18, Demi Marie Obenour wrote:
> Also add some error checks and use Bash features.
>
> No other functional change intended.
>
> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> Changes since v2:
>
> - Do not use wrapper script.
> - Make script non-executable.
> - Invoke script as 'bash FILE' to work around /usr/bin/env not working
> during a Nix build.
> ---
> host/initramfs/Makefile | 4 ++--
> host/rootfs/Makefile | 2 +-
> img/app/Makefile | 2 +-
> release/live/Makefile | 4 ++--
> scripts/make-gpt.sh | 20 ++++++++++----------
> vm/sys/net/Makefile | 2 +-
> 6 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile
> index 13bb548d6146684a25dab1e31228c0b9a4ca8db7..fd8cbb6c3e775ed27d0a524bf167cb4d3940d799 100644
> --- a/host/initramfs/Makefile
> +++ b/host/initramfs/Makefile
> @@ -36,7 +36,7 @@ build/mountpoints:
> find build/mountpoints -mindepth 1 -exec touch -d @0 {} ';'
>
> build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk $(ROOT_FS_IMAGES)
> - ../../scripts/make-gpt.sh $@.tmp \
> + bash ../../scripts/make-gpt.sh $@.tmp \
> $(ROOT_FS_VERITY):verity:$$(../../scripts/format-uuid.sh "$$(dd if=$(ROOT_FS_VERITY_ROOTHASH) bs=32 skip=1 count=1 status=none)") \
> $(ROOT_FS):root:$$(../../scripts/format-uuid.sh "$$(head -c 32 $(ROOT_FS_VERITY_ROOTHASH))")
> mv $@.tmp $@
> @@ -45,7 +45,7 @@ build/loop.tar: build/live.img
> $(TAR) -cf $@ build/live.img
>
> build/loop.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/loop.ext4
> - ../../scripts/make-gpt.sh $@.tmp \
> + bash ../../scripts/make-gpt.sh $@.tmp \
> build/loop.ext4:56a3bbc3-aefa-43d9-a64d-7b3fd59bbc4e
> mv $@.tmp $@
>
> diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
> index 4c14d3acfa8f7ffd276fdfb684d08bf58fd80a15..533471c58591d305f386157e04e9e48da7259fd5 100644
> --- a/host/rootfs/Makefile
> +++ b/host/rootfs/Makefile
> @@ -96,7 +96,7 @@ clean:
> .PHONY: clean
>
> build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk $(ROOT_FS_DIR)/verity-timestamp $(ROOT_FS)
> - ../../scripts/make-gpt.sh $@.tmp \
> + bash ../../scripts/make-gpt.sh $@.tmp \
> $(ROOT_FS)/rootfs.verity.superblock:verity:$$(../../scripts/format-uuid.sh "$$(dd if=$(ROOT_FS_VERITY_ROOTHASH) bs=32 skip=1 count=1 status=none)") \
> $(ROOT_FS)/rootfs:root:$$(../../scripts/format-uuid.sh "$$(head -c 32 $(ROOT_FS_VERITY_ROOTHASH)")
> mv $@.tmp $@
> diff --git a/img/app/Makefile b/img/app/Makefile
> index 48eba871339d314479f730101246ace3fa39e2db..f16c2df1b90bbec6750f2980da4dbaf49c9cb0ea 100644
> --- a/img/app/Makefile
> +++ b/img/app/Makefile
> @@ -26,7 +26,7 @@ $(imgdir)/appvm/vmlinux: $(KERNEL)
>
> $(imgdir)/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/rootfs.erofs
> mkdir -p $$(dirname $@)
> - ../../scripts/make-gpt.sh $@.tmp \
> + bash ../../scripts/make-gpt.sh $@.tmp \
> build/rootfs.erofs:root:5460386f-2203-4911-8694-91400125c604:root
> mv $@.tmp $@
>
> diff --git a/release/live/Makefile b/release/live/Makefile
> index d61248e94599adc5229d0ad38d54b9f649d66ca1..4dbac28a90dc6f64a253961c33c597220d0e85cf 100644
> --- a/release/live/Makefile
> +++ b/release/live/Makefile
> @@ -9,8 +9,8 @@ DTBS ?= build/empty
>
> dest = build/live.img
>
> -$(dest): ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/boot.fat $(ROOT_FS_IMAGES)
> - ../../scripts/make-gpt.sh $@.tmp \
> +$(dest): ../../scripts/format-uuid.sh ../../scripts/make-gpt.bash ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/boot.fat $(ROOT_FS_IMAGES)
> + bash ../../scripts/make-gpt.sh $@.tmp \
> build/boot.fat:c12a7328-f81f-11d2-ba4b-00a0c93ec93b \
> $(ROOT_FS_VERITY):verity:$$(../../scripts/format-uuid.sh "$$(dd if=$(ROOT_FS_VERITY_ROOTHASH) bs=32 skip=1 count=1 status=none)") \
> $(ROOT_FS):root:$$(../../scripts/format-uuid.sh "$$(head -c 32 $(ROOT_FS_VERITY_ROOTHASH))")

The new dependency on ../../make-gpt.bash is wrong and causes a
build failure. The dependency is removed in patch 6/14
("Support generating multiple partition UUIDs"), which is why
it wasn't caught by testing.

I now have access to a powerful server that can build release.nix in
a reasonable amount of time, which will allow me to do it on every
commit instead of just on selected commits. In fact, this is how I
found the problem.
--
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]