diff --git a/.gitattributes b/.gitattributes index 79847f7f..fcaecb86 100644 --- a/.gitattributes +++ b/.gitattributes @@ -30,3 +30,4 @@ *.zip binary *.tar.gz binary *.meta4 binary +*.zim binary diff --git a/iiab-android b/iiab-android index edfb19c3..f6ff2ae8 100644 --- a/iiab-android +++ b/iiab-android @@ -414,6 +414,35 @@ install_demo_contents() { ok "Demo content processing finished!" } +#----------------------------- +# K2Go welcome ZIM (post-install) +#----------------------------- +# Runs AFTER Ansible, so it never touches state during the role run. The +# upstream iiab/iiab kiwix role drops a placeholder test.zim "when +# kiwix_zims.matched == 0"; here we remove it, drop in our multilingual welcome +# ZIM (shipped in the cloned repo under static/zim/), and rebuild the Kiwix +# library ONCE so library.xml reflects the final state. +install_welcome_zim() { + is_role_enabled "kiwix" || { log "Kiwix off; skipping welcome ZIM."; return 0; } + local src="${K2GO_OPT_DIR}/static/zim/k2go_welcome.zim" + local zim_dir="/library/zims/content" + # Ansible already created this dir when kiwix installed; we never create it. + [ -d "$zim_dir" ] || { warn "No $zim_dir (kiwix not installed?); skipping."; return 0; } + + rm -f "$zim_dir/test.zim" # drop the upstream placeholder + if [ -f "$src" ]; then + cp -a "$src" "$zim_dir/k2go_welcome.zim" # ships in the cloned repo + else + warn "Welcome ZIM not found at $src; nothing installed." + fi + + if command -v iiab-make-kiwix-lib >/dev/null 2>&1; then + iiab-make-kiwix-lib # rebuild library.xml once + else + warn "iiab-make-kiwix-lib not found; library not rebuilt." + fi +} + #----------------------------- # Install IIAB-oA Dashboard #----------------------------- @@ -655,6 +684,9 @@ else log "Skipping the demo content installation (ENABLE_DEMO_CONTENTS=0)." fi +# Replace the upstream placeholder test.zim with the K2Go welcome ZIM. +install_welcome_zim + # Install dashboard install_iiaboa_dashboard diff --git a/static/zim/README.md b/static/zim/README.md new file mode 100644 index 00000000..dd877234 --- /dev/null +++ b/static/zim/README.md @@ -0,0 +1,16 @@ +# static/zim — bundled ZIM assets + +Small ZIM files that ship **with the K2Go repo** and are copied into +`/library/zims/content` at install time (see `install_welcome_zim` in the +top-level `iiab-android` wrapper). + +## k2go_welcome.zim + +A tiny multilingual welcome page (the K2Go logo ringed by "Welcome" in 33 +languages; the footer tagline auto-detects the device language via +`navigator.language`). It replaces the upstream placeholder `test.zim` that +iiab/iiab's kiwix role would otherwise install, so a fresh box always opens on a +branded welcome instead of a blank library. + +`*.zim` is marked `binary` in `.gitattributes`. If the file ever grows large, +consider Git LFS. diff --git a/static/zim/k2go_welcome.zim b/static/zim/k2go_welcome.zim new file mode 100644 index 00000000..b9251827 Binary files /dev/null and b/static/zim/k2go_welcome.zim differ diff --git a/ROOTFS_SIZE_PILOT_ANALYSIS.md b/tools/ROOTFS_SIZE_PILOT_ANALYSIS.md similarity index 100% rename from ROOTFS_SIZE_PILOT_ANALYSIS.md rename to tools/ROOTFS_SIZE_PILOT_ANALYSIS.md