From cad65d269e97d4480793f35d0cd697f1f0eb1621 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Thu, 2 Feb 2023 16:20:53 -0500 Subject: [PATCH] image-builder: Prevent bogus empty filesystems --- overlay/image-builder/filesystem-image/basic.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/overlay/image-builder/filesystem-image/basic.nix b/overlay/image-builder/filesystem-image/basic.nix index 42d0886b..07c257f0 100644 --- a/overlay/image-builder/filesystem-image/basic.nix +++ b/overlay/image-builder/filesystem-image/basic.nix @@ -238,6 +238,19 @@ in ( cd "$files" ${config.populateCommands} + + # This also activates dotglob automatically. + # Using this means hidden files will be added too. + GLOBIGNORE=".:.." + + if (( $(find -maxdepth 1 | wc -l) == 1 )); then + (set -x; ls -l) + + echo "" + echo "ERROR: populatePhase produced no files." + echo " tip: using mkForce or mkDefault at different places may unexpected overwrite values." + exit 2 + fi ) '';