Add guards against empty recipes/nonexistent images.

This is just a proof of concept at this point, trying to get `make` to
succeed.
This commit is contained in:
Cyril Brulebois
2025-11-29 12:26:55 +01:00
parent bd54ac4476
commit f15fe61586

View File

@@ -35,23 +35,35 @@ $(foreach release,$(BUILD_RELEASES), \
$(eval $(call dynamic_yaml_target,$(family),$(release))))) $(eval $(call dynamic_yaml_target,$(family),$(release)))))
%.img.sha256: %.img %.img.sha256: %.img
echo $@ if [ -e $< ]; then \
sha256sum $< > $@ echo $@; \
sha256sum $< > $@; \
fi
%.img.xz.sha256: %.img.xz %.img.xz.sha256: %.img.xz
echo $@ if [ -e $< ]; then \
sha256sum $< > $@ echo $@; \
sha256sum $< > $@; \
fi
%.img.xz: %.img %.img.xz: %.img
xz -f -k -z -9 $< if [ -e $< ]; then \
xz -f -k -z -9 $<; \
fi
%.img.bmap: %.img %.img.bmap: %.img
bmaptool create -o $@ $< if [ -e $< ]; then \
bmaptool create -o $@ $<; \
fi
%.img: %.yaml %.img: %.yaml
touch $(@:.img=.log) if [ ! -s $< ]; then \
time nice $(as_root) vmdb2 --verbose --rootfs-tarball=$(subst .img,.tar.gz,$@) --output=$@ $(subst .img,.yaml,$@) --log $(subst .img,.log,$@) echo "W: skipping empty recipe ($<)"; \
chmod 0644 $@ $(@,.img=.log) 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: _ck_root:
[ `whoami` = 'root' ] # Only root can summon vmdb2 ☹ [ `whoami` = 'root' ] # Only root can summon vmdb2 ☹