# Iterum installer # Usage (PowerShell): irm https://iterum.nhaajt.com/install.ps1 | iex # # What it does, in order: # 1. downloads one zip to a staging folder next to the install folder # 2. checks its SHA-256 and stops if it does not match # 3. unzips it to %LOCALAPPDATA%\Iterum (asks you to close Iterum first if it is running) # 4. adds a Start menu and a Desktop shortcut # 5. deletes the temp files # No admin rights, no services, no scheduled tasks, no execution policy changes. & { # ---- release ------------------------------------------------------------- $Url = 'https://iterum.nhaajt.com/download/Iterum.zip' $Sha256 = 'aa4136464425f9ad822bb5b927e4ff9a68cd21c7b05da61b712298a44f9f34a2' # ---- where things go ----------------------------------------------------- $InstallDir = Join-Path $env:LOCALAPPDATA 'Iterum' $StartMenuDir = Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs' $DesktopDir = [Environment]::GetFolderPath('Desktop') $ExeName = 'Iterum.exe' # -------------------------------------------------------------------------- $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 function Say($msg) { Write-Host " $msg" } function Ok($msg) { Write-Host " $msg" -ForegroundColor Green } function Fail($msg) { Write-Host '' Write-Host " INSTALL STOPPED: $msg" -ForegroundColor Red Write-Host ' Nothing was installed or changed.' -ForegroundColor Red Write-Host '' throw "Iterum install stopped: $msg" } # Some game files sit deep in folders; rd with the \\?\ prefix removes paths longer than 260 characters. function Remove-Tree($path) { if ($path -and (Test-Path -LiteralPath $path)) { cmd /c "rd /s /q `"\\?\$path`"" | Out-Null } } # Staging next to the install folder keeps paths short (some game files sit deep in folders). $Temp = Join-Path $env:LOCALAPPDATA ('Iterum.setup-' + [Guid]::NewGuid().ToString('N').Substring(0, 8)) $Zip = Join-Path $Temp 'Iterum.zip' $Unz = Join-Path $Temp 'unzipped' Write-Host '' Write-Host ' ITERUM once more.' -ForegroundColor Red Write-Host '' try { New-Item -ItemType Directory -Path $Temp -Force | Out-Null # 1. download Say "Downloading $Url" try { Invoke-WebRequest -Uri $Url -OutFile $Zip -UseBasicParsing } catch { Fail "download failed ($($_.Exception.Message))" } $size = [math]::Round((Get-Item $Zip).Length / 1MB, 1) Ok "Downloaded $size MB" # 2. verify $actual = (Get-FileHash -Path $Zip -Algorithm SHA256).Hash if ($actual -ne $Sha256.ToUpperInvariant()) { Write-Host " expected: $($Sha256.ToUpperInvariant())" -ForegroundColor Red Write-Host " got: $actual" -ForegroundColor Red Fail 'SHA-256 does not match. The file may be damaged or not the real release.' } Ok 'SHA-256 matches' # 3. unzip to a staging folder first, so a bad zip never touches the old install $tar = Join-Path $env:SystemRoot 'System32\tar.exe' New-Item -ItemType Directory -Path $Unz -Force | Out-Null if (Test-Path $tar) { & $tar -xf $Zip -C $Unz if ($LASTEXITCODE -ne 0) { Fail "unzip failed (tar exit code $LASTEXITCODE)" } } else { Expand-Archive -Path $Zip -DestinationPath $Unz -Force } $src = $Unz if (-not (Test-Path (Join-Path $src $ExeName))) { $inner = @(Get-ChildItem -Path $Unz -Directory) if ($inner.Count -eq 1 -and (Test-Path (Join-Path $inner[0].FullName $ExeName))) { $src = $inner[0].FullName } else { Fail "the zip does not contain $ExeName" } } # replace the old install only once Iterum is closed $exePath = Join-Path $InstallDir $ExeName while ($true) { $running = @(Get-Process -Name 'Iterum' -ErrorAction SilentlyContinue | Where-Object { try { $_.Path -and ($_.Path -like "$InstallDir\*") } catch { $true } }) if ($running.Count -eq 0) { break } Write-Host ' Iterum is running. Close it, then press Enter (or type q to cancel).' -ForegroundColor Yellow $answer = Read-Host ' ' if ($null -eq $answer -or $answer -match '^\s*q') { Fail 'Iterum is still running.' } } if (Test-Path $InstallDir) { Say 'Removing the old version' Remove-Tree $InstallDir } New-Item -ItemType Directory -Path (Split-Path $InstallDir -Parent) -Force | Out-Null Move-Item -Path $src -Destination $InstallDir Ok "Installed to $InstallDir" # 4. shortcuts $shell = New-Object -ComObject WScript.Shell foreach ($dir in @($StartMenuDir, $DesktopDir)) { if (-not $dir) { continue } New-Item -ItemType Directory -Path $dir -Force | Out-Null $lnk = $shell.CreateShortcut((Join-Path $dir 'Iterum.lnk')) $lnk.TargetPath = $exePath $lnk.WorkingDirectory = $InstallDir $lnk.IconLocation = "$exePath,0" $lnk.Description = 'Iterum, an offline aim trainer' $lnk.Save() } Ok 'Shortcuts added: Start menu, Desktop' Write-Host '' Ok 'Done. Start Iterum from the Start menu or the Desktop.' Say 'It never goes online. To remove it later:' Say 'irm https://iterum.nhaajt.com/uninstall.ps1 | iex' Write-Host '' } finally { Remove-Tree $Temp } }