From fa9b5abb44dcaf7735d6e5b56532cca3b943e7ef Mon Sep 17 00:00:00 2001 From: Ralf-Peter Wolff Date: Mon, 4 May 2026 11:39:02 +0200 Subject: [PATCH] Add setup-windows.bat for automated upterm installation on new devices --- setup-windows.bat | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 setup-windows.bat diff --git a/setup-windows.bat b/setup-windows.bat new file mode 100644 index 0000000..0fe8667 --- /dev/null +++ b/setup-windows.bat @@ -0,0 +1,77 @@ +@echo off +setlocal EnableDelayedExpansion +chcp 65001 >/dev/null + +echo ============================================================ +echo upterm Setup +echo ============================================================ +echo. + +:: Adminrechte prüfen +net session >/dev/null 2>&1 +if %errorLevel% neq 0 ( + echo Starte mit Administratorrechten neu... + powershell -Command "Start-Process '%~f0' -Verb RunAs" + exit /b +) + +:: Execution Policy setzen +echo [1/4] Setze PowerShell Execution Policy... +powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force" +if %errorLevel% neq 0 ( + echo FEHLER: Execution Policy konnte nicht gesetzt werden. + pause & exit /b 1 +) +echo OK + +:: Scoop prüfen / installieren +echo [2/4] Prüfe Scoop... +powershell -Command "Get-Command scoop" >/dev/null 2>&1 +if %errorLevel% neq 0 ( + echo Scoop nicht gefunden - wird installiert... + powershell -Command "Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression" + if !errorLevel! neq 0 ( + echo FEHLER: Scoop Installation fehlgeschlagen. + pause & exit /b 1 + ) + echo Scoop installiert. +) else ( + echo Scoop bereits vorhanden. +) + +:: lessmsi aktivieren + 7zip installieren +echo [3/4] Installiere 7zip via lessmsi... +powershell -Command "scoop config use_lessmsi true" +powershell -Command "scoop install 7zip" >/dev/null 2>&1 +if %errorLevel% neq 0 ( + echo 7zip fehlgeschlagen - bereinige und versuche erneut... + powershell -Command "scoop uninstall 7zip; scoop cache rm 7zip; Remove-Item -Recurse -Force "$env:USERPROFILE\scoop\apps\7zip" -ErrorAction SilentlyContinue; scoop install 7zip" + if !errorLevel! neq 0 ( + echo FEHLER: 7zip konnte nicht installiert werden. + pause & exit /b 1 + ) +) +echo OK + +:: upterm installieren +echo [4/4] Installiere upterm... +powershell -Command "scoop bucket add upterm https://github.com/owenthereal/scoop-upterm; scoop install upterm" +if %errorLevel% neq 0 ( + echo FEHLER: upterm Installation fehlgeschlagen. + pause & exit /b 1 +) +echo OK + +echo. +echo ============================================================ +echo Installation abgeschlossen! +echo ============================================================ +echo. +echo PowerShell neu starten, dann Session teilen mit: +echo. +echo upterm host --server ssh://upterm.ebesch.de:2222 --accept +echo. +echo Client verbindet sich mit: +echo ssh TOKEN:HASH@upterm.ebesch.de -p 2222 +echo. +pause