diff --git a/toolkit/scripts/imggen.mk b/toolkit/scripts/imggen.mk index 4f9a9327fb8..881f30d6437 100644 --- a/toolkit/scripts/imggen.mk +++ b/toolkit/scripts/imggen.mk @@ -79,8 +79,10 @@ clean-imagegen: # the same, but the actual .rpm files may be fundamentally different. $(STATUS_FLAGS_DIR)/imagegen_cleanup.flag: $(depend_REPO_SNAPSHOT_TIME) @echo "REPO_SNAPSHOT_TIME has changed, sanitizing rpm cache" - find "$(local_and_external_rpm_cache)" -type f -name '*.rpm' -delete - touch $@ + @if [ -d "$(local_and_external_rpm_cache)" ]; then \ + find "$(local_and_external_rpm_cache)" -type f -name '*.rpm' -delete; \ + fi + @touch $@ ##help:target:fetch-image-packages=Locate and download all packages required for an image build. fetch-image-packages: $(image_package_cache_summary) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 4e3b0c5f18f..d714e29124a 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -269,8 +269,10 @@ clean-compress-srpms: # the same, but the actual .rpm files may be fundamentally different. $(STATUS_FLAGS_DIR)/build_packages_cache_cleanup.flag: $(depend_REPO_SNAPSHOT_TIME) @echo "REPO_SNAPSHOT_TIME has changed, sanitizing rpm cache" - find "$(remote_rpms_cache_dir)" -type f -name '*.rpm' -delete - touch $@ + @if [ -d "$(remote_rpms_cache_dir)" ]; then \ + find "$(remote_rpms_cache_dir)" -type f -name '*.rpm' -delete; \ + fi + @touch $@ ifeq ($(REBUILD_PACKAGES),y) $(RPMS_DIR): $(STATUS_FLAGS_DIR)/build-rpms.flag