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)))))
%.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 ☹