Add setup-windows.bat for automated upterm installation on new devices

This commit is contained in:
2026-05-04 11:39:02 +02:00
parent 227567d5db
commit fa9b5abb44

77
setup-windows.bat Normal file
View File

@ -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