From cd150a7911c07cc8ced348ccaf1a155697ca1745 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 02:21:54 +0000 Subject: [PATCH] Move ZIM selection into the wizard so all prompts complete before downloads start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The "select which ZIMs" menu now fires during Q4 (upfront wizard), alongside the yes/select/no choice, not after docker/models start - Each ZIM entry shows [downloaded] if a matching .zim already exists in KIWIX_DIR — skips re-downloading automatically via dl_zim check - Download phase now uses the pre-captured ZIM_PICKS directly, no interactive prompt mid-install https://claude.ai/code/session_012gDnantBmFTWZGCiKyjazx --- laptop_full_setup.sh | 59 +++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/laptop_full_setup.sh b/laptop_full_setup.sh index 212fc64..87bf63a 100755 --- a/laptop_full_setup.sh +++ b/laptop_full_setup.sh @@ -301,6 +301,41 @@ if $SVC_KIWIX; then echo "" read -rp " Choice [3]: " ZIM_CHOICE ZIM_CHOICE="${ZIM_CHOICE:-3}" + + # ── Q4a: ZIM selection (only if choice == 2) ────────────────────────────── + ZIM_PICKS="" + if [[ "$ZIM_CHOICE" == "2" ]]; then + # Helper: show [done] if a ZIM matching a glob pattern already exists + _zim_tag() { + local pattern="$1" + ls "$KIWIX_DIR"/${pattern}*.zim 2>/dev/null | grep -q . && echo " ${GREEN}[downloaded]${NC}" || echo "" + } + echo "" + echo " Select ZIMs to download (space-separated numbers, e.g. 1 3 5):" + echo " ZIMs already in $KIWIX_DIR are marked [downloaded]." + echo "" + printf " %2s) %-26s %6s %s\n" 1 "Wikipedia" "~46GB" "$(_zim_tag "wikipedia_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 2 "Stack Overflow" "~3GB" "$(_zim_tag "stackoverflow.com_en_all")" + printf " %2s) %-26s %6s %s\n" 3 "Arch Linux Wiki" "~30MB" "$(_zim_tag "archlinux_en_all")" + printf " %2s) %-26s %6s %s\n" 4 "Wiktionary" "~2GB" "$(_zim_tag "wiktionary_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 5 "Wikibooks" "~500MB" "$(_zim_tag "wikibooks_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 6 "Wikisource" "~4GB" "$(_zim_tag "wikisource_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 7 "Wikivoyage" "~200MB" "$(_zim_tag "wikivoyage_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 8 "Wikiversity" "~500MB" "$(_zim_tag "wikiversity_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 9 "WikiNews" "~300MB" "$(_zim_tag "wikinews_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 10 "Wikiquote" "~300MB" "$(_zim_tag "wikiquote_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 11 "Vikidia (kids K-8)" "~66MB" "$(_zim_tag "vikidia_en_all_nopic")" + printf " %2s) %-26s %6s %s\n" 12 "TED Talks" "~5GB" "$(_zim_tag "ted_mul_youth")" + printf " %2s) %-26s %6s %s\n" 13 "PhET Simulations" "~500MB" "$(_zim_tag "phet_en_all")" + printf " %2s) %-26s %6s %s\n" 14 "DevDocs" "~1GB" "$(_zim_tag "devdocs_en_zig")" + printf " %2s) %-26s %6s %s\n" 15 "FreeCodeCamp" "~small" "$(_zim_tag "freecodecamp_en_all")" + printf " %2s) %-26s %6s %s\n" 16 "iFixit" "~2GB" "$(_zim_tag "ifixit_en_all")" + printf " %2s) %-26s %6s %s\n" 17 "LibreTexts" "~varies" "$(_zim_tag "libretexts.org_en")" + printf " %2s) %-26s %6s %s\n" 18 "Project Gutenberg" "~60GB" "$(_zim_tag "gutenberg_en_all")" + echo "" + read -rp " Your choices (e.g. 1 2 3): " ZIM_PICKS + unset -f _zim_tag + fi else ZIM_CHOICE="3" fi @@ -1183,29 +1218,7 @@ if $SVC_KIWIX && [[ "$ZIM_CHOICE" != "3" ]]; then GUT=$(latest_zim "$MIRROR2/gutenberg" "gutenberg_en_all") if [[ "$ZIM_CHOICE" == "2" ]]; then - # Let user select which ZIMs - echo "" - echo " Select ZIMs to download (enter numbers separated by spaces):" - echo " 1) Wikipedia ~46GB ${WIKI:-NOT FOUND}" - echo " 2) Stack Overflow ~3GB ${SO:-NOT FOUND}" - echo " 3) Arch Linux Wiki ~30MB ${ARCH:-NOT FOUND}" - echo " 4) Wiktionary ~2GB ${WIKT:-NOT FOUND}" - echo " 5) Wikibooks ~500MB ${WIKB:-NOT FOUND}" - echo " 6) Wikisource ~4GB ${WIKS:-NOT FOUND}" - echo " 7) Wikivoyage ~200MB ${WIKV:-NOT FOUND}" - echo " 8) Wikiversity ~500MB ${WIKUNI:-NOT FOUND}" - echo " 9) WikiNews ~300MB ${WIKNEWS:-NOT FOUND}" - echo " 10) Wikiquote ~300MB ${WIKQ:-NOT FOUND}" - echo " 11) Vikidia (kids K-8) ~66MB ${VIKIDIA:-NOT FOUND}" - echo " 12) TED Talks ~5GB ${TED:-NOT FOUND}" - echo " 13) PhET Simulations ~500MB ${PHET:-NOT FOUND}" - echo " 14) DevDocs ~1GB ${DEVDOCS:-NOT FOUND}" - echo " 15) FreeCodeCamp ~small ${FCC:-NOT FOUND}" - echo " 16) iFixit ~2GB ${IFIX:-NOT FOUND}" - echo " 17) LibreTexts ~varies ${LIBRE:-NOT FOUND}" - echo " 18) Project Gutenberg ~60GB ${GUT:-NOT FOUND}" - echo "" - read -rp " Your choices (e.g. 1 2 3): " ZIM_PICKS + # ZIM_PICKS was captured during the wizard — just dispatch rm -f "$KIWIX_DIR/.download_pids" for n in $ZIM_PICKS; do case "$n" in