From 804492567b11eb4995b617817911f410f9535aa7 Mon Sep 17 00:00:00 2001 From: Enes Date: Tue, 10 Nov 2026 14:01:42 +0300 Subject: [PATCH 1/2] =?UTF-8?q?Remove=20unfinished=20downloads=20of=20olde?= =?UTF-8?q?r=20ZIM=20versions=20/=20Eski=20s=C3=BCr=C3=BCmlerin=20yar?= =?UTF-8?q?=C4=B1m=20indirmelerini=20sil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a download is interrupted and a newer version of the same ZIM is out by the next run, the old _YYYY-MM.zim.part is never resumed and never removed: the old-version cleanup only matches *.zim. It keeps its space (up to ~120 GB for English Wikipedia), counts as used in the free-space check, and status.sh reports an unfinished download forever. Remove partial files of other versions of the same prefix before the free-space check. Bir indirme yarıda kalır ve sonraki çalıştırmada aynı ZIM'in yeni sürümü çıkmışsa eski _YYYY-MM.zim.part dosyasına ne devam edilir ne de silinir: eski sürüm temizliği yalnızca *.zim dosyalarına bakar. Dosya yerini korur (İngilizce Vikipedi için ~120 GB'a kadar), yer kontrolünde dolu sayılır ve status.sh sürekli yarım indirme uyarısı verir. Aynı adın diğer sürümlerinin yarım dosyaları yer kontrolünden önce silinir. Co-Authored-By: Claude Opus 5.5 --- scripts/download-content.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/download-content.sh b/scripts/download-content.sh index 0df02c9..e50dde3 100755 --- a/scripts/download-content.sh +++ b/scripts/download-content.sh @@ -52,6 +52,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 From 624cc5a4dc9d046475aa553a68eef8e3275fcacb Mon Sep 17 00:00:00 2001 From: Enes Date: Tue, 10 Nov 2026 14:01:42 +0300 Subject: [PATCH 2/2] =?UTF-8?q?Remove=20the=20catalog=20temp=20file=20when?= =?UTF-8?q?=20the=20catalog=20is=20unreachable=20/=20Katalog=20al=C4=B1nam?= =?UTF-8?q?azsa=20ge=C3=A7ici=20dosyay=C4=B1=20sil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The EXIT trap removes "$CAT", but the fallback path clears CAT first, so the mktemp file was left in /tmp. Remove it before clearing the variable. EXIT trap'i "$CAT"i siler, ama klasör listesine düşülürken CAT önce boşaltıldığı için mktemp dosyası /tmp'de kalıyordu. Değişken boşaltılmadan önce dosya silinir. Co-Authored-By: Claude Opus 5.5 --- scripts/download-content.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/download-content.sh b/scripts/download-content.sh index e50dde3..7a9ba52 100755 --- a/scripts/download-content.sh +++ b/scripts/download-content.sh @@ -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