# LuminixManager 설치 스크립트 (Windows, PowerShell 5.1 이상) # # 홈페이지에서 받은 뒤: powershell -ExecutionPolicy Bypass -File install.ps1 # 작업 폴더 지정: powershell -ExecutionPolicy Bypass -File install.ps1 -DataDir D:\LuminixManager # 내려받은 묶음으로 설치: powershell -ExecutionPolicy Bypass -File install.ps1 -Package .\luminix-2026.11.21.1.zip # # 하는 일: 파이썬 확인 -> 배포 묶음 받기(크기·SHA-256 확인) -> 설치 폴더에 풀기 -> 파이썬 가상환경·패키지 -> # 인식 모델 받기 -> 설정 파일 쓰기 -> 설치 점검 -> 시작 스크립트 만들기. # 하지 않는 일: 관리자 권한 요구, 시스템 설정 변경, Photoshop 설치. 원본 사진 폴더는 건드리지 않는다. param( [string]$InstallDir = (Join-Path $env:LOCALAPPDATA 'LuminixManager'), [string]$DataDir = (Join-Path $env:USERPROFILE 'LuminixManager'), [string]$Server = 'https://luminixmanager.com', [string]$Package = '', # 배포 정보 서명을 확인하는 서버 공개키 (Ed25519). 서버 응답에서 받아 오지 않고 여기에 고정한다: # 서버가 바뀌거나 탈취돼도 이 키로 서명되지 않은 패치는 실행기가 거부한다. [string]$PublicKey = 'XblRJBLZQFd6hzzq/S9Hgc3JEkIBUVlmUZTV8vEgmTM=', [switch]$AutoStart, [switch]$SkipPhotoshopCheck ) $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 function Step([string]$Text) { Write-Host "`n== $Text" -ForegroundColor Cyan } # ---------------------------------------------------------------- 1. 파이썬 Step '파이썬 확인' $python = $null foreach ($candidate in @(@('py', '-3.12'), @('py', '-3.13'), @('py', '-3.11'), @('python'))) { try { $exe = $candidate[0]; $rest = @($candidate | Select-Object -Skip 1) $version = & $exe @rest -c "import sys; print('%d.%d' % sys.version_info[:2])" 2>$null if ($LASTEXITCODE -eq 0 -and [version]$version -ge [version]'3.11') { $python = $candidate; break } } catch { } } if (-not $python) { Write-Host '파이썬 3.11 이상이 필요합니다. https://www.python.org/downloads/ 에서 3.12 를 설치한 뒤 다시 실행해 주세요.' -ForegroundColor Yellow Write-Host '(설치할 때 "Add python.exe to PATH" 를 켜 주세요. 또는: winget install Python.Python.3.12)' exit 1 } Write-Host "파이썬 $version 사용" # ---------------------------------------------------------------- 2. 배포 묶음 Step '배포 묶음 준비' New-Item -ItemType Directory -Force -Path $InstallDir, (Join-Path $InstallDir 'releases'), (Join-Path $InstallDir 'downloads') | Out-Null if ($Package) { $archive = (Resolve-Path $Package).Path Write-Host "내려받은 묶음 사용: $archive" } else { $manifest = Invoke-RestMethod -Uri "$Server/api/v1/release" -UseBasicParsing $archive = Join-Path $InstallDir "downloads\luminix-$($manifest.version).zip" Write-Host "버전 $($manifest.version) 받는 중 ($([math]::Round($manifest.size / 1MB, 1))MB)" Invoke-WebRequest -Uri $manifest.url -OutFile $archive -UseBasicParsing $hash = (Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLower() if ((Get-Item -LiteralPath $archive).Length -ne $manifest.size -or $hash -ne $manifest.sha256) { Remove-Item -LiteralPath $archive -Force throw '내려받은 묶음이 서버 기록과 다릅니다. 다시 시도해 주세요.' } } # ---------------------------------------------------------------- 3. 풀기 Step '설치 폴더에 풀기' Add-Type -AssemblyName System.IO.Compression.FileSystem $zip = [IO.Compression.ZipFile]::OpenRead($archive) try { $entry = $zip.GetEntry('release.json') if (-not $entry) { throw '묶음에 release.json 이 없습니다.' } $reader = New-Object IO.StreamReader($entry.Open(), [Text.Encoding]::UTF8) try { $release = $reader.ReadToEnd() | ConvertFrom-Json } finally { $reader.Dispose() } } finally { $zip.Dispose() } if ($release.version -notmatch '^\d+(\.\d+)*$') { throw '묶음의 버전 형식이 잘못됐습니다.' } $releaseDir = Join-Path $InstallDir "releases\$($release.version)" if (Test-Path -LiteralPath $releaseDir) { Remove-Item -LiteralPath $releaseDir -Recurse -Force } [IO.Compression.ZipFile]::ExtractToDirectory($archive, $releaseDir) Copy-Item -LiteralPath (Join-Path $releaseDir 'launcher.py') -Destination (Join-Path $InstallDir 'launcher.py') -Force Write-Host "버전 $($release.version) (엔진 $($release.engine_build))" # ---------------------------------------------------------------- 4. 가상환경 Step '파이썬 가상환경' $venvPython = Join-Path $InstallDir '.venv\Scripts\python.exe' if (-not (Test-Path -LiteralPath $venvPython)) { $exe = $python[0]; $rest = @($python | Select-Object -Skip 1) & $exe @rest -m venv (Join-Path $InstallDir '.venv') if ($LASTEXITCODE -ne 0) { throw '가상환경을 만들지 못했습니다.' } } & $venvPython -m pip install --disable-pip-version-check -q --upgrade pip Write-Host '가상환경 준비됨' # ---------------------------------------------------------------- 5. 패키지·모델·설정·점검 (실행기가 한다) Step '패키지·인식 모델 설치와 점검 (몇 분 걸릴 수 있습니다)' $setup = @((Join-Path $InstallDir 'launcher.py'), '--setup', '--data-dir', $DataDir, '--server', $Server) if ($PublicKey) { $setup += @('--public-key', $PublicKey) } if ($SkipPhotoshopCheck) { $setup += '--no-photoshop' } $env:PYTHONUTF8 = '1' & $venvPython @setup $ok = ($LASTEXITCODE -eq 0) # ---------------------------------------------------------------- 6. 시작 스크립트 Step '시작 스크립트' $starter = Join-Path $InstallDir 'LuminixManager 시작.cmd' $lines = @('@echo off', 'chcp 65001 >nul', 'title LuminixManager 도우미', "`"$venvPython`" `"$(Join-Path $InstallDir 'launcher.py')`"", 'pause') [IO.File]::WriteAllLines($starter, $lines, (New-Object Text.UTF8Encoding($false))) Write-Host "시작: $starter" if ($AutoStart) { $startup = [Environment]::GetFolderPath('Startup') $shell = New-Object -ComObject WScript.Shell $link = $shell.CreateShortcut((Join-Path $startup 'LuminixManager.lnk')) $link.TargetPath = $starter; $link.WindowStyle = 7; $link.Save() Write-Host '윈도 시작 시 자동 실행 등록됨' } Write-Host '' if ($ok) { Write-Host '설치가 끝났습니다. "LuminixManager 시작.cmd" 를 실행한 뒤 https://luminixmanager.com/app 을 여세요.' -ForegroundColor Green exit 0 } Write-Host '설치는 됐지만 위의 [실패] 항목을 해결해야 보정을 실행할 수 있습니다.' -ForegroundColor Yellow exit 1