From e7dc55454b53ec34ac3c73620bee9165def5861a Mon Sep 17 00:00:00 2001 From: Michel Abboud Date: Fri, 30 Jan 2026 10:42:10 +0000 Subject: [PATCH] fix: Check for existing ISOs instead of empty dir in cache restore The data directories contain .gitkeep files, so the empty-directory check (ls -A) always returned non-empty and cache restore never triggered. Now checks for *.iso files specifically, which is the actual condition that determines whether a download is needed. Co-Authored-By: Claude Opus 4.5 --- winctl.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/winctl.sh b/winctl.sh index 457b7b9..f7f88dd 100755 --- a/winctl.sh +++ b/winctl.sh @@ -1075,13 +1075,15 @@ cmd_start() { mkdir -p "$data_dir" fi - # Pre-populate from ISO cache if data dir is empty - if [[ -z "$(ls -A "$data_dir" 2>/dev/null)" ]]; then + # Pre-populate from ISO cache if no ISO exists in data dir + local existing_isos + existing_isos=$(find "$data_dir" -maxdepth 1 -name '*.iso' -type f 2>/dev/null || true) + if [[ -z "$existing_isos" ]]; then local cache_src="$ISO_CACHE_DIR/$RESOLVED_BASE" if [[ -d "$cache_src" ]]; then - local iso_files - iso_files=$(find "$cache_src" -maxdepth 1 -name '*.iso' -type f 2>/dev/null || true) - if [[ -n "$iso_files" ]]; then + local cached_isos + cached_isos=$(find "$cache_src" -maxdepth 1 -name '*.iso' -type f 2>/dev/null || true) + if [[ -n "$cached_isos" ]]; then info "Restoring cached ISO for $RESOLVED_BASE..." cp "$cache_src"/*.iso "$data_dir/" # Reset magic byte so the container re-processes the ISO