Skip to content
Open
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
10 changes: 10 additions & 0 deletions scripts/download-content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ mountpoint -q /library || echo "Uyarı / warning: /library ayrı bir disk değil
echo ">> Kiwix kataloğu alınıyor / fetching Kiwix catalog"
if ! curl -fsSL -m 300 "$CATALOG_URL" -o "$CAT"; then
echo "!! Katalog alınamadı, klasör listesine düşülüyor / catalog unreachable, falling back to directory listings"
# CAT boşalınca EXIT trap'i dosyayı silemez, önce sil / once CAT is cleared the EXIT trap can't remove the file
rm -f "$CAT"
CAT=""
fi

Expand All @@ -52,6 +54,14 @@ while read -r folder prefix _; do
if [ -z "$url" ]; then echo "!! $prefix bulunamadı / not found in the Kiwix catalog (ad değişmiş veya kaldırılmış olabilir / name may have changed or been retired)"; failed=1; continue; fi
latest=$(basename "$url")

# Eski sürümlerin yarım indirmelerini sil: yeni sürüm çıkınca bunlara devam edilmez, ama yer
# kaplar ve aşağıdaki yer kontrolünde dolu sayılır.
# Remove unfinished downloads of older versions: they are never resumed once a newer version is
# out, but they take up space and count as used in the free-space check below.
for part in "$DEST/${prefix}"_[0-9][0-9][0-9][0-9]-[0-9][0-9]*.zim.part; do
[ "$part" != "$DEST/$latest.part" ] && [ -f "$part" ] && { echo "-- eski yarım indirme siliniyor / removing stale partial download $part"; rm -f "$part"; }
done

if [ -f "$DEST/$latest" ]; then echo "== $latest zaten var / already present"; continue; fi

# Yer kontrolü / free-space check: kalan boyut + pay / remaining bytes + headroom
Expand Down