From f15fe6158618c40e0982e5669bd2f6df8682fb66 Mon Sep 17 00:00:00 2001 From: Cyril Brulebois Date: Sat, 29 Nov 2025 12:26:55 +0100 Subject: [PATCH] Add guards against empty recipes/nonexistent images. This is just a proof of concept at this point, trying to get `make` to succeed. --- Makefile | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 48da239..eb2714f 100644 --- a/Makefile +++ b/Makefile @@ -35,23 +35,35 @@ $(foreach release,$(BUILD_RELEASES), \ $(eval $(call dynamic_yaml_target,$(family),$(release))))) %.img.sha256: %.img - echo $@ - sha256sum $< > $@ + if [ -e $< ]; then \ + echo $@; \ + sha256sum $< > $@; \ + fi %.img.xz.sha256: %.img.xz - echo $@ - sha256sum $< > $@ + if [ -e $< ]; then \ + echo $@; \ + sha256sum $< > $@; \ + fi %.img.xz: %.img - xz -f -k -z -9 $< + if [ -e $< ]; then \ + xz -f -k -z -9 $<; \ + fi %.img.bmap: %.img - bmaptool create -o $@ $< + if [ -e $< ]; then \ + bmaptool create -o $@ $<; \ + fi %.img: %.yaml - touch $(@:.img=.log) - time nice $(as_root) vmdb2 --verbose --rootfs-tarball=$(subst .img,.tar.gz,$@) --output=$@ $(subst .img,.yaml,$@) --log $(subst .img,.log,$@) - chmod 0644 $@ $(@,.img=.log) + if [ ! -s $< ]; then \ + echo "W: skipping empty recipe ($<)"; \ + else \ + touch $(@:.img=.log); \ + time nice $(as_root) vmdb2 --verbose --rootfs-tarball=$(subst .img,.tar.gz,$@) --output=$@ $(subst .img,.yaml,$@) --log $(subst .img,.log,$@); \ + chmod 0644 $@ $(@,.img=.log); \ + fi _ck_root: [ `whoami` = 'root' ] # Only root can summon vmdb2 ☹