@echo off
chcp 65001 >nul
setlocal EnableExtensions
title LODOS Standart indiriliyor / downloading
rem LODOS Standart 0.4.1: GitHub'daki 4 parçayı indirir, birleştirir ve SHA-256 ile doğrular.
rem Downloads the 4 parts from GitHub, joins them and verifies the SHA-256 checksum.
set "FILE=lodos-0.4.1-amd64.iso"
set "N=4"
set "SHA=99628a953fcccf0a4218e8591896779762c233120cae0e2a3b5e41f24c73ece0"
set "URL=https://github.com/royalteknoloji/lodos/releases/download/v0.4.1"
set "DIR=%USERPROFILE%\Downloads\LODOS"
if not exist "%DIR%" mkdir "%DIR%"
cd /d "%DIR%"
echo.
echo  LODOS Standart 0.4.1  (6,6 GB)
echo  Klasor / Folder: %DIR%
echo  Baglanti kesilirse bu dosyayi yeniden calistirin; kaldigi yerden devam eder.
echo  If the connection drops, run this file again; it resumes where it stopped.
echo.
for /L %%i in (1,1,%N%) do (
  echo  [%%i/%N%] %FILE%.00%%i
  curl.exe -L --fail --retry 5 --retry-delay 3 -C - -o "%FILE%.00%%i" "%URL%/%FILE%.00%%i" || goto :hata
)
echo.
echo  Parcalar birlestiriliyor ve dogrulaniyor / Joining and verifying...
powershell -NoProfile -ExecutionPolicy Bypass -Command "$f='%FILE%'; $o=[IO.File]::Create($f); Get-ChildItem ($f+'.0*') | Sort-Object Name | ForEach-Object { $i=[IO.File]::OpenRead($_.FullName); $i.CopyTo($o); $i.Close() }; $o.Close(); $h=(Get-FileHash $f -Algorithm SHA256).Hash.ToLower(); if ($h -ne '%SHA%') { exit 1 }; Remove-Item ($f+'.0*')" || goto :hata
echo.
echo  TAMAM / DONE: %DIR%\%FILE%
echo  Simdi Rufus (https://rufus.ie) ile bu dosyayi en az 16 GB'lik bir USB bellege yazin.
echo  Now write this file to a USB stick of 16 GB or more with Rufus (https://rufus.ie).
explorer /select,"%DIR%\%FILE%"
pause
exit /b 0
:hata
echo.
echo  HATA / ERROR: indirme ya da dogrulama basarisiz. Bu dosyayi yeniden calistirin.
echo  Download or verification failed. Run this file again.
pause
exit /b 1
