85 lines
4.1 KiB
PowerShell
85 lines
4.1 KiB
PowerShell
# washtime External Uploader — Windows 자동 설치
|
|
# 한 줄 실행 (PowerShell 관리자):
|
|
# iwr -useb http://192.168.1.40:3000/washtime/tools/raw/branch/main/install-eu-windows.ps1 | iex
|
|
#
|
|
# 동작:
|
|
# 1) 최신 installer .exe 다운로드 (washtime 서버에서)
|
|
# 2) 다운로드 검증 (SHA256, 옵션)
|
|
# 3) 자동 실행 (silent 또는 GUI)
|
|
# 4) 설치 후 auto_updater 가 자동으로 차후 업데이트 처리
|
|
#
|
|
# 이후 사용자는 더 이상 액션 불필요 — daemon 이 백그라운드에서 publisher-certs API 보고
|
|
# 자동으로 새 버전 다운로드 + helper.exe 가 swap 처리.
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
# ───── 설정 ─────
|
|
$installerUrl = 'http://washtime.asuscomm.com:5055/downloads/ExternalUploader-Setup-latest.exe'
|
|
$installerLocal = "$env:TEMP\ExternalUploader-Setup.exe"
|
|
$installMode = 'gui' # 'gui' = NSIS GUI / 'silent' = /S 무인설치
|
|
|
|
Write-Host ''
|
|
Write-Host '════════════════════════════════════════════════════════' -ForegroundColor Cyan
|
|
Write-Host ' washtime External Uploader 자동 설치' -ForegroundColor Cyan
|
|
Write-Host '════════════════════════════════════════════════════════' -ForegroundColor Cyan
|
|
Write-Host ''
|
|
|
|
# ───── 1) 다운로드 ─────
|
|
Write-Host "[1/3] installer 다운로드…" -ForegroundColor Yellow
|
|
Write-Host " URL: $installerUrl"
|
|
Write-Host " 저장: $installerLocal"
|
|
try {
|
|
$ProgressPreference = 'SilentlyContinue' # iwr 진행률 표시 끔 (속도 위해)
|
|
Invoke-WebRequest -Uri $installerUrl -OutFile $installerLocal -UseBasicParsing
|
|
$size = (Get-Item $installerLocal).Length
|
|
Write-Host " ✔ 다운로드 완료 ($([math]::Round($size/1MB, 1)) MB)" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host " ✗ 다운로드 실패: $_" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
# ───── 2) 검증 ─────
|
|
Write-Host ''
|
|
Write-Host '[2/3] 파일 검증…' -ForegroundColor Yellow
|
|
$hash = (Get-FileHash $installerLocal -Algorithm SHA256).Hash
|
|
Write-Host " SHA256: $hash"
|
|
if ($size -lt 100MB) {
|
|
Write-Host ' ✗ 파일 크기 비정상 (100MB 미만). 다운로드 손상 의심.' -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
Write-Host ' ✔ OK' -ForegroundColor Green
|
|
|
|
# ───── 3) 설치 ─────
|
|
Write-Host ''
|
|
Write-Host '[3/3] installer 실행…' -ForegroundColor Yellow
|
|
if ($installMode -eq 'silent') {
|
|
Write-Host ' silent 모드 (/S)'
|
|
$proc = Start-Process -FilePath $installerLocal -ArgumentList '/S' -Wait -PassThru
|
|
if ($proc.ExitCode -eq 0) {
|
|
Write-Host ' ✔ 설치 완료' -ForegroundColor Green
|
|
} else {
|
|
Write-Host " ✗ installer exit code: $($proc.ExitCode)" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
} else {
|
|
Write-Host ' GUI 모드 — installer 창이 열리면 따라가세요'
|
|
Start-Process -FilePath $installerLocal -Wait
|
|
Write-Host ' ✔ installer 종료됨' -ForegroundColor Green
|
|
}
|
|
|
|
# ───── 정리 ─────
|
|
Remove-Item $installerLocal -Force -ErrorAction SilentlyContinue
|
|
|
|
Write-Host ''
|
|
Write-Host '════════════════════════════════════════════════════════' -ForegroundColor Cyan
|
|
Write-Host ' ✅ 설치 완료' -ForegroundColor Green
|
|
Write-Host '════════════════════════════════════════════════════════' -ForegroundColor Cyan
|
|
Write-Host ''
|
|
Write-Host '다음 단계:'
|
|
Write-Host ' 1) 시작 메뉴에서 "ExternalUploader" 실행'
|
|
Write-Host ' 2) 시스템 트레이의 아이콘 우클릭 → 설정'
|
|
Write-Host ' 3) Memily 폴더 (~/Memily/<board-name>) 에 미디어 넣으면 자동 업로드'
|
|
Write-Host ''
|
|
Write-Host '향후 업데이트는 daemon 이 백그라운드에서 자동 처리 (사용자 액션 X).'
|
|
Write-Host ''
|