Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
*.zip binary
*.tar.gz binary
*.meta4 binary
*.zim binary
32 changes: 32 additions & 0 deletions iiab-android
Original file line number Diff line number Diff line change
Expand Up @@ -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
#-----------------------------
Expand Down Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions static/zim/README.md
Original file line number Diff line number Diff line change
@@ -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.
Binary file added static/zim/k2go_welcome.zim
Binary file not shown.
File renamed without changes.
Loading