mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 01:27:11 +00:00
Upgrade installers to v2.1.1 with SHA256 verification and auto mode
- Added SHA256 checksum verification for all binaries - Added --auto/-Auto flag for non-interactive installation - Added --skip-verify/-SkipVerify to bypass verification - Updated systemd services with correct API port (21120) - Added API_PORT environment variable support - Improved service templates with documentation links - Updated VERSION to 2.1.1
This commit is contained in:
@@ -7,45 +7,45 @@
|
||||
|
||||
## 📊 Stan Projektu (aktualizacja: 2026-02-08)
|
||||
|
||||
### Wersja Skryptów ALL-IN-ONE (v2.0.0)
|
||||
### Wersja Skryptów ALL-IN-ONE (v2.1.1)
|
||||
|
||||
| Plik | Wersja | Platforma | Status |
|
||||
|------|--------|-----------|--------|
|
||||
| `betterdesk.sh` | v2.0.0 | Linux | ✅ Nowy - interaktywny ALL-IN-ONE |
|
||||
| `betterdesk.ps1` | v2.0.0 | Windows | ✅ Nowy - interaktywny ALL-IN-ONE |
|
||||
| `betterdesk-docker.sh` | v2.0.0 | Docker | ✅ Nowy - interaktywny ALL-IN-ONE |
|
||||
|
||||
### Skrypty Legacy (dla zaawansowanych)
|
||||
|
||||
| Plik | Wersja | Status |
|
||||
|------|--------|--------|
|
||||
| `install-improved.sh` | v1.5.5 | ⚠️ Legacy - bez menu interaktywnego |
|
||||
| `install-improved.ps1` | v1.5.2 | ⚠️ Legacy - bez menu interaktywnego |
|
||||
| `betterdesk.sh` | v2.1.1 | Linux | ✅ ALL-IN-ONE + SHA256 verification + Auto mode |
|
||||
| `betterdesk.ps1` | v2.1.1 | Windows | ✅ ALL-IN-ONE + SHA256 verification + Auto mode |
|
||||
| `betterdesk-docker.sh` | v2.0.0 | Docker | ✅ Interaktywny ALL-IN-ONE |
|
||||
|
||||
### Binarki Serwera
|
||||
|
||||
| Platforma | Plik | Wersja | Status | Data |
|
||||
|-----------|------|--------|--------|------|
|
||||
| Linux x86_64 | `hbbs-patch-v2/hbbs-linux-x86_64` | v2.0.0 | ✅ Przetestowana | 2026-02-02 |
|
||||
| Linux x86_64 | `hbbs-patch-v2/hbbr-linux-x86_64` | v2.0.0 | ✅ Przetestowana | 2026-02-02 |
|
||||
| Windows x86_64 | `hbbs-patch-v2/hbbs-windows-x86_64.exe` | v2.0.0 | ✅ Przetestowana | 2026-02-04 |
|
||||
| Windows x86_64 | `hbbs-patch-v2/hbbr-windows-x86_64.exe` | v2.0.0 | ✅ Przetestowana | 2026-02-04 |
|
||||
| Linux x86_64 | `hbbs-patch-v2/hbbs-linux-x86_64` | v2.1.1 | ✅ Przetestowana | 2026-02-08 |
|
||||
| Linux x86_64 | `hbbs-patch-v2/hbbr-linux-x86_64` | v2.1.1 | ✅ Przetestowana | 2026-02-08 |
|
||||
| Windows x86_64 | `hbbs-patch-v2/hbbs-windows-x86_64.exe` | v2.1.1 | ✅ Przetestowana | 2026-02-08 |
|
||||
| Windows x86_64 | `hbbs-patch-v2/hbbr-windows-x86_64.exe` | v2.1.1 | ✅ Przetestowana | 2026-02-08 |
|
||||
|
||||
### Sumy Kontrolne SHA256
|
||||
|
||||
```
|
||||
Linux:
|
||||
hbbs: 2D99FE55378AC6CDED8A4D5BDA717367BBCF17B83B6AADA0D080C02C3BF1B2C1
|
||||
hbbr: C7197CF9FCBFB47BB4C9F6D4663DF29B27D2A9AB008FF7AE32A13C6150024528
|
||||
hbbs: 2B6C475A449ECBA3786D0DB46CBF4E038EDB74FC3497F9A45791ADDD5A28834C
|
||||
hbbr: 507DC4DFDF118DBE9450DA0D7CCE4A5989D9308616A1F1C3D3FFFFC3B4E01DFD
|
||||
|
||||
Windows:
|
||||
hbbs: 50BA3BCE44AC607917C2B6870B2859D2F5DB59769E79F6BFB3E757244A53A7F7
|
||||
hbbr: 78E7B0F61B7DF8FD780550B8AB9F81F802C3C63CD8171BD93194EC23CA51EB94
|
||||
hbbs: 682AA117AEEC8A6408DB4462BD31EB9DE943D5F70F5C27F3383F1DF56028A6E3
|
||||
hbbr: B585D077D5512035132BBCE3CE6CBC9D034E2DAE0805A799B3196C7372D82BEA
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Skrypty ALL-IN-ONE (v2.0.0)
|
||||
## 🚀 Skrypty ALL-IN-ONE (v2.1.1)
|
||||
|
||||
### Nowe funkcje w v2.1.1
|
||||
|
||||
- ✅ **Weryfikacja SHA256** - automatyczna weryfikacja sum kontrolnych binarek
|
||||
- ✅ **Tryb automatyczny** - instalacja bez interakcji użytkownika (`--auto` / `-Auto`)
|
||||
- ✅ **Konfigurowalne porty API** - zmienne środowiskowe `API_PORT`
|
||||
- ✅ **Ulepszone usługi systemd** - lepsze konfiguracje z dokumentacją
|
||||
|
||||
### Funkcje wspólne dla wszystkich skryptów
|
||||
|
||||
@@ -62,43 +62,53 @@ Windows:
|
||||
### Użycie
|
||||
|
||||
```bash
|
||||
# Linux
|
||||
# Linux - tryb interaktywny
|
||||
sudo ./betterdesk.sh
|
||||
|
||||
# Windows (PowerShell jako Administrator)
|
||||
# Linux - tryb automatyczny (bez interakcji)
|
||||
sudo ./betterdesk.sh --auto
|
||||
|
||||
# Linux - pomiń weryfikację SHA256
|
||||
sudo ./betterdesk.sh --skip-verify
|
||||
|
||||
# Windows (PowerShell jako Administrator) - tryb interaktywny
|
||||
.\betterdesk.ps1
|
||||
|
||||
# Windows - tryb automatyczny
|
||||
.\betterdesk.ps1 -Auto
|
||||
|
||||
# Windows - pomiń weryfikację SHA256
|
||||
.\betterdesk.ps1 -SkipVerify
|
||||
|
||||
# Docker
|
||||
./betterdesk-docker.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Narzędzia Diagnostyczne
|
||||
## 🛠️ Konfiguracja portu API
|
||||
|
||||
### Zmienne środowiskowe
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
# Diagnoza problemów (offline status, zła binarka, porty)
|
||||
sudo ./install-improved.sh --diagnose
|
||||
# Linux - niestandardowy port API
|
||||
API_PORT=21120 sudo ./betterdesk.sh --auto
|
||||
|
||||
# Szybka naprawa - wymiana binarek na BetterDesk
|
||||
sudo ./install-improved.sh --fix
|
||||
|
||||
# Pełna instalacja/aktualizacja
|
||||
sudo ./install-improved.sh
|
||||
# Windows
|
||||
$env:API_PORT = "21114"
|
||||
.\betterdesk.ps1 -Auto
|
||||
```
|
||||
|
||||
### Windows (PowerShell)
|
||||
```powershell
|
||||
# Diagnoza problemów
|
||||
.\install-improved.ps1 -Diagnose
|
||||
### Domyślne porty
|
||||
|
||||
# Szybka naprawa binarek
|
||||
.\install-improved.ps1 -Fix
|
||||
|
||||
# Pełna instalacja
|
||||
.\install-improved.ps1
|
||||
```
|
||||
| Port | Usługa | Opis |
|
||||
|------|--------|------|
|
||||
| 21120 | HTTP API (Linux) | BetterDesk HTTP API (domyślny Linux) |
|
||||
| 21114 | HTTP API (Windows) | BetterDesk HTTP API (domyślny Windows) |
|
||||
| 21115 | TCP | NAT type test |
|
||||
| 21116 | TCP/UDP | ID Server (rejestracja klientów) |
|
||||
| 21117 | TCP | Relay Server |
|
||||
| 5000 | HTTP | Web Console |
|
||||
|
||||
### Skrypt diagnostyczny (dev)
|
||||
```bash
|
||||
|
||||
+172
-24
@@ -1,6 +1,6 @@
|
||||
#===============================================================================
|
||||
#
|
||||
# BetterDesk Console Manager v2.0
|
||||
# BetterDesk Console Manager v2.1.1
|
||||
# All-in-One Interactive Tool for Windows
|
||||
#
|
||||
# Features:
|
||||
@@ -12,16 +12,46 @@
|
||||
# - Reset admin password
|
||||
# - Build custom binaries
|
||||
# - Full diagnostics
|
||||
# - SHA256 binary verification
|
||||
# - Auto mode (non-interactive)
|
||||
#
|
||||
# Usage: Run as Administrator
|
||||
# .\betterdesk.ps1
|
||||
# Interactive: .\betterdesk.ps1
|
||||
# Auto mode: .\betterdesk.ps1 -Auto
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$Auto,
|
||||
[switch]$SkipVerify,
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Version = "2.0.0"
|
||||
$Version = "2.1.1"
|
||||
|
||||
# Show help
|
||||
if ($Help) {
|
||||
Write-Host "BetterDesk Console Manager v$Version"
|
||||
Write-Host ""
|
||||
Write-Host "Usage: .\betterdesk.ps1 [OPTIONS]"
|
||||
Write-Host ""
|
||||
Write-Host "Options:"
|
||||
Write-Host " -Auto Run in automatic mode (non-interactive)"
|
||||
Write-Host " -SkipVerify Skip SHA256 verification of binaries"
|
||||
Write-Host " -Help Show this help message"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Binary checksums (SHA256) - v2.1.1
|
||||
$Script:HBBS_WINDOWS_SHA256 = "682AA117AEEC8A6408DB4462BD31EB9DE943D5F70F5C27F3383F1DF56028A6E3"
|
||||
$Script:HBBR_WINDOWS_SHA256 = "B585D077D5512035132BBCE3CE6CBC9D034E2DAE0805A799B3196C7372D82BEA"
|
||||
|
||||
# API configuration
|
||||
$Script:ApiPort = if ($env:API_PORT) { $env:API_PORT } else { "21114" }
|
||||
|
||||
# Default paths (can be overridden by environment variables)
|
||||
$Script:RustdeskPath = if ($env:RUSTDESK_PATH) { $env:RUSTDESK_PATH } else { "" }
|
||||
@@ -396,6 +426,85 @@ function Install-Dependencies {
|
||||
Write-Success "Python installed"
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
# Binary Verification Functions
|
||||
#===============================================================================
|
||||
|
||||
function Test-BinaryChecksum {
|
||||
param(
|
||||
[string]$FilePath,
|
||||
[string]$ExpectedHash
|
||||
)
|
||||
|
||||
$fileName = Split-Path $FilePath -Leaf
|
||||
|
||||
if (-not (Test-Path $FilePath)) {
|
||||
Write-Error2 "File not found: $FilePath"
|
||||
return $false
|
||||
}
|
||||
|
||||
Write-Info "Verifying $fileName..."
|
||||
$actualHash = (Get-FileHash -Path $FilePath -Algorithm SHA256).Hash
|
||||
|
||||
if ($actualHash -eq $ExpectedHash) {
|
||||
Write-Success "$fileName`: SHA256 OK"
|
||||
return $true
|
||||
} else {
|
||||
Write-Error2 "$fileName`: SHA256 MISMATCH!"
|
||||
Write-Error2 " Expected: $ExpectedHash"
|
||||
Write-Error2 " Got: $actualHash"
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
function Test-Binaries {
|
||||
Write-Step "Verifying BetterDesk binaries..."
|
||||
|
||||
$binSource = Join-Path $Script:ScriptDir "hbbs-patch-v2"
|
||||
$errors = 0
|
||||
|
||||
if ($SkipVerify) {
|
||||
Write-Warning2 "Verification skipped (-SkipVerify)"
|
||||
return $true
|
||||
}
|
||||
|
||||
# Verify Windows binaries
|
||||
$hbbsPath = Join-Path $binSource "hbbs-windows-x86_64.exe"
|
||||
$hbbrPath = Join-Path $binSource "hbbr-windows-x86_64.exe"
|
||||
|
||||
if (Test-Path $hbbsPath) {
|
||||
if (-not (Test-BinaryChecksum -FilePath $hbbsPath -ExpectedHash $Script:HBBS_WINDOWS_SHA256)) {
|
||||
$errors++
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path $hbbrPath) {
|
||||
if (-not (Test-BinaryChecksum -FilePath $hbbrPath -ExpectedHash $Script:HBBR_WINDOWS_SHA256)) {
|
||||
$errors++
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors -gt 0) {
|
||||
Write-Error2 "Binary verification failed! $errors error(s)"
|
||||
Write-Warning2 "Binaries may be corrupted or outdated."
|
||||
if (-not $Auto) {
|
||||
if (-not (Confirm-Action "Continue anyway?")) {
|
||||
return $false
|
||||
}
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
} else {
|
||||
Write-Success "All binaries verified"
|
||||
}
|
||||
|
||||
return $true
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
# Installation Functions
|
||||
#===============================================================================
|
||||
|
||||
function Install-Binaries {
|
||||
Write-Step "Installing BetterDesk binaries..."
|
||||
|
||||
@@ -418,11 +527,20 @@ function Install-Binaries {
|
||||
return $false
|
||||
}
|
||||
|
||||
# Verify binaries before installation
|
||||
if (-not (Test-Binaries)) {
|
||||
Write-Error2 "Aborting installation due to verification failure"
|
||||
return $false
|
||||
}
|
||||
|
||||
# Copy binaries
|
||||
Copy-Item "$binSource\hbbs-windows-x86_64.exe" "$Script:RustdeskPath\hbbs.exe" -Force
|
||||
Copy-Item "$binSource\hbbr-windows-x86_64.exe" "$Script:RustdeskPath\hbbr.exe" -Force
|
||||
Write-Success "Installed hbbs.exe (signal server)"
|
||||
|
||||
Write-Success "Binaries installed"
|
||||
Copy-Item "$binSource\hbbr-windows-x86_64.exe" "$Script:RustdeskPath\hbbr.exe" -Force
|
||||
Write-Success "Installed hbbr.exe (relay server)"
|
||||
|
||||
Write-Success "BetterDesk binaries v$Version installed"
|
||||
return $true
|
||||
}
|
||||
|
||||
@@ -467,11 +585,14 @@ function Initialize-WindowsServices {
|
||||
"127.0.0.1"
|
||||
}
|
||||
|
||||
# Create start scripts
|
||||
Write-Info "Server IP: $serverIp"
|
||||
Write-Info "API Port: $Script:ApiPort"
|
||||
|
||||
# Create start scripts with correct API port
|
||||
$hbbsStartScript = @"
|
||||
@echo off
|
||||
cd /d "$Script:RustdeskPath"
|
||||
hbbs.exe -r $serverIp -k _ --api-port 21114
|
||||
hbbs.exe -r $serverIp -k _ --api-port $Script:ApiPort
|
||||
"@
|
||||
|
||||
$hbbrStartScript = @"
|
||||
@@ -485,6 +606,7 @@ hbbr.exe -k _
|
||||
cd /d "$Script:ConsolePath"
|
||||
call venv\Scripts\activate
|
||||
set RUSTDESK_PATH=$Script:RustdeskPath
|
||||
set API_PORT=$Script:ApiPort
|
||||
python app.py
|
||||
"@
|
||||
|
||||
@@ -501,7 +623,7 @@ python app.py
|
||||
$action = New-ScheduledTaskAction -Execute "$Script:RustdeskPath\start-hbbs.bat"
|
||||
$trigger = New-ScheduledTaskTrigger -AtStartup
|
||||
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount
|
||||
Register-ScheduledTask -TaskName "BetterDesk-HBBS" -Action $action -Trigger $trigger -Principal $principal -Description "BetterDesk Signal Server" | Out-Null
|
||||
Register-ScheduledTask -TaskName "BetterDesk-HBBS" -Action $action -Trigger $trigger -Principal $principal -Description "BetterDesk Signal Server v$Version" | Out-Null
|
||||
|
||||
$taskExists = Get-ScheduledTask -TaskName "BetterDesk-HBBR" -ErrorAction SilentlyContinue
|
||||
if ($taskExists) {
|
||||
@@ -509,9 +631,10 @@ python app.py
|
||||
}
|
||||
|
||||
$action = New-ScheduledTaskAction -Execute "$Script:RustdeskPath\start-hbbr.bat"
|
||||
Register-ScheduledTask -TaskName "BetterDesk-HBBR" -Action $action -Trigger $trigger -Principal $principal -Description "BetterDesk Relay Server" | Out-Null
|
||||
Register-ScheduledTask -TaskName "BetterDesk-HBBR" -Action $action -Trigger $trigger -Principal $principal -Description "BetterDesk Relay Server v$Version" | Out-Null
|
||||
|
||||
Write-Success "Services configured"
|
||||
Write-Success "Windows services configured"
|
||||
Write-Info "Tasks: BetterDesk-HBBS, BetterDesk-HBBR"
|
||||
}
|
||||
|
||||
function Invoke-Migrations {
|
||||
@@ -639,22 +762,31 @@ function Invoke-Install {
|
||||
|
||||
if ($Script:InstallStatus -eq "complete") {
|
||||
Write-Warning2 "BetterDesk is already installed!"
|
||||
if (-not (Confirm-Action "Do you want to reinstall?")) {
|
||||
return
|
||||
if (-not $Auto) {
|
||||
if (-not (Confirm-Action "Do you want to reinstall?")) {
|
||||
return
|
||||
}
|
||||
}
|
||||
Invoke-BackupSilent
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Info "Starting BetterDesk Console installation..."
|
||||
Write-Info "Starting BetterDesk Console v$Version installation..."
|
||||
Write-Host ""
|
||||
|
||||
Install-Dependencies
|
||||
if (-not (Install-Binaries)) { Wait-ForEnter; return }
|
||||
if (-not (Install-Console)) { Wait-ForEnter; return }
|
||||
Setup-WindowsServices
|
||||
Run-Migrations
|
||||
Create-AdminUser
|
||||
if (-not (Install-Binaries)) {
|
||||
Write-Error2 "Binary installation failed"
|
||||
if (-not $Auto) { Wait-ForEnter }
|
||||
return $false
|
||||
}
|
||||
if (-not (Install-Console)) {
|
||||
if (-not $Auto) { Wait-ForEnter }
|
||||
return $false
|
||||
}
|
||||
Initialize-WindowsServices
|
||||
Invoke-Migrations
|
||||
New-AdminUser
|
||||
Start-Services
|
||||
|
||||
Write-Host ""
|
||||
@@ -671,16 +803,21 @@ function Invoke-Install {
|
||||
}
|
||||
|
||||
Write-Host " ╔════════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
|
||||
Write-Host " ║ Information about installation ║" -ForegroundColor Cyan
|
||||
Write-Host " ║ INSTALLATION INFO ║" -ForegroundColor Cyan
|
||||
Write-Host " ╠════════════════════════════════════════════════════════════╣" -ForegroundColor Cyan
|
||||
Write-Host " ║ Web Panel: http://${serverIp}:5000 ║" -ForegroundColor Cyan
|
||||
Write-Host " ║ Server ID: $serverIp ║" -ForegroundColor Cyan
|
||||
Write-Host " ║ Web Panel: http://${serverIp}:5000 ║" -ForegroundColor Cyan
|
||||
Write-Host " ║ API Port: $Script:ApiPort ║" -ForegroundColor Cyan
|
||||
Write-Host " ║ Server ID: $serverIp ║" -ForegroundColor Cyan
|
||||
if ($publicKey) {
|
||||
Write-Host " ║ Key: $($publicKey.Substring(0, [Math]::Min(20, $publicKey.Length)))... ║" -ForegroundColor Cyan
|
||||
Write-Host " ║ Key: $($publicKey.Substring(0, [Math]::Min(20, $publicKey.Length)))... ║" -ForegroundColor Cyan
|
||||
}
|
||||
Write-Host " ╚════════════════════════════════════════════════════════════╝" -ForegroundColor Cyan
|
||||
|
||||
Wait-ForEnter
|
||||
if (-not $Auto) {
|
||||
Wait-ForEnter
|
||||
}
|
||||
|
||||
return $true
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
@@ -1280,7 +1417,18 @@ Find-Paths
|
||||
Write-Host ""
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
# Main
|
||||
# Auto mode - run installation directly
|
||||
if ($Auto) {
|
||||
Write-Info "Running in AUTO mode..."
|
||||
$result = Invoke-Install
|
||||
if ($result) {
|
||||
exit 0
|
||||
} else {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Interactive Main Menu
|
||||
while ($true) {
|
||||
Show-Menu
|
||||
$choice = Read-Host " Select option"
|
||||
|
||||
+177
-22
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#===============================================================================
|
||||
#
|
||||
# BetterDesk Console Manager v2.0
|
||||
# BetterDesk Console Manager v2.1.1
|
||||
# All-in-One Interactive Tool for Linux
|
||||
#
|
||||
# Features:
|
||||
@@ -13,22 +13,66 @@
|
||||
# - Reset admin password
|
||||
# - Build custom binaries
|
||||
# - Full diagnostics
|
||||
# - SHA256 binary verification
|
||||
# - Auto mode (non-interactive)
|
||||
#
|
||||
# Usage: sudo ./betterdesk.sh
|
||||
# Usage:
|
||||
# Interactive: sudo ./betterdesk.sh
|
||||
# Auto mode: sudo ./betterdesk.sh --auto
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
# Version
|
||||
VERSION="2.0.0"
|
||||
VERSION="2.1.1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Auto mode flag
|
||||
AUTO_MODE=false
|
||||
SKIP_VERIFY=false
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--auto|-a)
|
||||
AUTO_MODE=true
|
||||
shift
|
||||
;;
|
||||
--skip-verify)
|
||||
SKIP_VERIFY=true
|
||||
shift
|
||||
;;
|
||||
--help|-h)
|
||||
echo "BetterDesk Console Manager v$VERSION"
|
||||
echo ""
|
||||
echo "Usage: sudo ./betterdesk.sh [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --auto, -a Run in automatic mode (non-interactive)"
|
||||
echo " --skip-verify Skip SHA256 verification of binaries"
|
||||
echo " --help, -h Show this help message"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Binary checksums (SHA256) - v2.1.1
|
||||
HBBS_LINUX_X86_64_SHA256="2B6C475A449ECBA3786D0DB46CBF4E038EDB74FC3497F9A45791ADDD5A28834C"
|
||||
HBBR_LINUX_X86_64_SHA256="507DC4DFDF118DBE9450DA0D7CCE4A5989D9308616A1F1C3D3FFFFC3B4E01DFD"
|
||||
|
||||
# Default paths (can be overridden by environment variables)
|
||||
RUSTDESK_PATH="${RUSTDESK_PATH:-}"
|
||||
CONSOLE_PATH="${CONSOLE_PATH:-}"
|
||||
BACKUP_DIR="${BACKUP_DIR:-/opt/rustdesk-backups}"
|
||||
|
||||
# API configuration
|
||||
API_PORT="${API_PORT:-21120}"
|
||||
|
||||
# Common installation paths to search
|
||||
COMMON_RUSTDESK_PATHS=(
|
||||
"/opt/rustdesk"
|
||||
@@ -413,6 +457,82 @@ print_status() {
|
||||
echo ""
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
# Binary Verification Functions
|
||||
#===============================================================================
|
||||
|
||||
verify_binary_checksum() {
|
||||
local file_path="$1"
|
||||
local expected_hash="$2"
|
||||
local file_name=$(basename "$file_path")
|
||||
|
||||
if [ ! -f "$file_path" ]; then
|
||||
print_error "File not found: $file_path"
|
||||
return 1
|
||||
fi
|
||||
|
||||
print_info "Verifying $file_name..."
|
||||
local actual_hash
|
||||
actual_hash=$(sha256sum "$file_path" | awk '{print toupper($1)}')
|
||||
|
||||
if [ "$actual_hash" = "$expected_hash" ]; then
|
||||
print_success "$file_name: SHA256 OK"
|
||||
return 0
|
||||
else
|
||||
print_error "$file_name: SHA256 MISMATCH!"
|
||||
print_error " Expected: $expected_hash"
|
||||
print_error " Got: $actual_hash"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
verify_binaries() {
|
||||
print_step "Verifying BetterDesk binaries..."
|
||||
|
||||
local bin_source="$SCRIPT_DIR/hbbs-patch-v2"
|
||||
local errors=0
|
||||
|
||||
if [ "$SKIP_VERIFY" = true ]; then
|
||||
print_warning "Verification skipped (--skip-verify)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Verify based on architecture
|
||||
case "$ARCH_NAME" in
|
||||
x86_64)
|
||||
if [ -f "$bin_source/hbbs-linux-x86_64" ]; then
|
||||
verify_binary_checksum "$bin_source/hbbs-linux-x86_64" "$HBBS_LINUX_X86_64_SHA256" || ((errors++))
|
||||
fi
|
||||
if [ -f "$bin_source/hbbr-linux-x86_64" ]; then
|
||||
verify_binary_checksum "$bin_source/hbbr-linux-x86_64" "$HBBR_LINUX_X86_64_SHA256" || ((errors++))
|
||||
fi
|
||||
;;
|
||||
aarch64)
|
||||
print_warning "ARM64 binaries - checksum verification not available"
|
||||
print_info "Consider building from source for ARM64"
|
||||
;;
|
||||
*)
|
||||
print_warning "Unknown architecture - checksum verification skipped"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $errors -gt 0 ]; then
|
||||
print_error "Binary verification failed! $errors error(s)"
|
||||
print_warning "Binaries may be corrupted or outdated."
|
||||
if [ "$AUTO_MODE" = false ]; then
|
||||
if ! confirm "Continue anyway?"; then
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
print_success "All binaries verified"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
# Installation Functions
|
||||
#===============================================================================
|
||||
@@ -456,24 +576,33 @@ install_binaries() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Verify binaries before installation
|
||||
if ! verify_binaries; then
|
||||
print_error "Aborting installation due to verification failure"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Copy binaries
|
||||
if [ -f "$bin_source/hbbs-linux-$ARCH_NAME" ]; then
|
||||
cp "$bin_source/hbbs-linux-$ARCH_NAME" "$RUSTDESK_PATH/hbbs"
|
||||
print_success "Installed hbbs (signal server)"
|
||||
elif [ -f "$bin_source/hbbs" ]; then
|
||||
cp "$bin_source/hbbs" "$RUSTDESK_PATH/hbbs"
|
||||
fi
|
||||
|
||||
if [ -f "$bin_source/hbbr-linux-$ARCH_NAME" ]; then
|
||||
cp "$bin_source/hbbr-linux-$ARCH_NAME" "$RUSTDESK_PATH/hbbr"
|
||||
print_success "Installed hbbr (relay server)"
|
||||
elif [ -f "$bin_source/hbbr" ]; then
|
||||
cp "$bin_source/hbbr" "$RUSTDESK_PATH/hbbr"
|
||||
fi
|
||||
|
||||
chmod +x "$RUSTDESK_PATH/hbbs" "$RUSTDESK_PATH/hbbr"
|
||||
|
||||
print_success "Binaries installed"
|
||||
print_success "BetterDesk binaries v$VERSION installed"
|
||||
}
|
||||
|
||||
|
||||
install_console() {
|
||||
print_step "Installing Web Console..."
|
||||
|
||||
@@ -509,52 +638,65 @@ setup_services() {
|
||||
local server_ip
|
||||
server_ip=$(curl -s ifconfig.me 2>/dev/null || curl -s icanhazip.com 2>/dev/null || echo "127.0.0.1")
|
||||
|
||||
# HBBS service
|
||||
print_info "Server IP: $server_ip"
|
||||
print_info "API Port: $API_PORT"
|
||||
|
||||
# HBBS service (Signal Server with HTTP API)
|
||||
cat > /etc/systemd/system/rustdesksignal.service << EOF
|
||||
[Unit]
|
||||
Description=BetterDesk Signal Server
|
||||
Description=BetterDesk Signal Server v$VERSION
|
||||
Documentation=https://github.com/UNITRONIX/Rustdesk-FreeConsole
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=$RUSTDESK_PATH
|
||||
ExecStart=$RUSTDESK_PATH/hbbs -r $server_ip -k _ --api-port 21114
|
||||
ExecStart=$RUSTDESK_PATH/hbbs -r $server_ip -k _ --api-port $API_PORT
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
LimitNOFILE=1000000
|
||||
Environment=RUST_BACKTRACE=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# HBBR service
|
||||
# HBBR service (Relay Server)
|
||||
cat > /etc/systemd/system/rustdeskrelay.service << EOF
|
||||
[Unit]
|
||||
Description=BetterDesk Relay Server
|
||||
Description=BetterDesk Relay Server v$VERSION
|
||||
Documentation=https://github.com/UNITRONIX/Rustdesk-FreeConsole
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=$RUSTDESK_PATH
|
||||
ExecStart=$RUSTDESK_PATH/hbbr -k _
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
LimitNOFILE=1000000
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Console service
|
||||
# Console service (Web Interface)
|
||||
cat > /etc/systemd/system/betterdesk.service << EOF
|
||||
[Unit]
|
||||
Description=BetterDesk Web Console
|
||||
After=network.target
|
||||
Documentation=https://github.com/UNITRONIX/Rustdesk-FreeConsole
|
||||
After=network.target rustdesksignal.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=$CONSOLE_PATH
|
||||
ExecStart=$CONSOLE_PATH/venv/bin/python app.py
|
||||
Environment=FLASK_ENV=production
|
||||
Environment=RUSTDESK_PATH=$RUSTDESK_PATH
|
||||
Environment=API_PORT=$API_PORT
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
@@ -564,7 +706,8 @@ EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
print_success "Services configured"
|
||||
print_success "Systemd services configured"
|
||||
print_info "Services: rustdesksignal, rustdeskrelay, betterdesk"
|
||||
}
|
||||
|
||||
run_migrations() {
|
||||
@@ -667,19 +810,21 @@ do_install() {
|
||||
|
||||
if [ "$INSTALL_STATUS" = "complete" ]; then
|
||||
print_warning "BetterDesk is already installed!"
|
||||
if ! confirm "Do you want to reinstall?"; then
|
||||
return
|
||||
if [ "$AUTO_MODE" = false ]; then
|
||||
if ! confirm "Do you want to reinstall?"; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
do_backup
|
||||
do_backup_silent
|
||||
fi
|
||||
|
||||
echo ""
|
||||
print_info "Starting BetterDesk Console installation..."
|
||||
print_info "Starting BetterDesk Console v$VERSION installation..."
|
||||
echo ""
|
||||
|
||||
install_dependencies
|
||||
detect_architecture
|
||||
install_binaries
|
||||
install_binaries || { print_error "Binary installation failed"; return 1; }
|
||||
install_console
|
||||
setup_services
|
||||
run_migrations
|
||||
@@ -698,14 +843,17 @@ do_install() {
|
||||
fi
|
||||
|
||||
echo -e "${CYAN}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${CYAN}║ INSTALLATION INFO ║${NC}"
|
||||
echo -e "${CYAN}║ INSTALLATION INFO ║${NC}"
|
||||
echo -e "${CYAN}╠════════════════════════════════════════════════════════════╣${NC}"
|
||||
echo -e "${CYAN}║ Panel Web: ${WHITE}http://$server_ip:5000${CYAN} ║${NC}"
|
||||
echo -e "${CYAN}║ Server ID: ${WHITE}$server_ip${CYAN} ║${NC}"
|
||||
echo -e "${CYAN}║ Key: ${WHITE}${public_key:0:20}...${CYAN} ║${NC}"
|
||||
echo -e "${CYAN}║ Panel Web: ${WHITE}http://$server_ip:5000${CYAN} ║${NC}"
|
||||
echo -e "${CYAN}║ API Port: ${WHITE}$API_PORT${CYAN} ║${NC}"
|
||||
echo -e "${CYAN}║ Server ID: ${WHITE}$server_ip${CYAN} ║${NC}"
|
||||
echo -e "${CYAN}║ Key: ${WHITE}${public_key:0:20}...${CYAN} ║${NC}"
|
||||
echo -e "${CYAN}╚════════════════════════════════════════════════════════════╝${NC}"
|
||||
|
||||
press_enter
|
||||
if [ "$AUTO_MODE" = false ]; then
|
||||
press_enter
|
||||
fi
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
@@ -1354,6 +1502,13 @@ main() {
|
||||
echo ""
|
||||
sleep 1
|
||||
|
||||
# Auto mode - run installation directly
|
||||
if [ "$AUTO_MODE" = true ]; then
|
||||
print_info "Running in AUTO mode..."
|
||||
do_install
|
||||
exit $?
|
||||
fi
|
||||
|
||||
while true; do
|
||||
show_menu
|
||||
read -p "Select option: " choice
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
[Unit]
|
||||
Description=RustDesk Relay Server (BetterDesk Enhanced)
|
||||
Description=BetterDesk Relay Server v2.1.1
|
||||
Documentation=https://github.com/UNITRONIX/Rustdesk-FreeConsole
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/rustdesk
|
||||
ExecStart=/opt/rustdesk/hbbr-v8-api
|
||||
ExecStart=/opt/rustdesk/hbbr -k _
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
LimitNOFILE=1000000
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
[Unit]
|
||||
Description=RustDesk Signal Server (BetterDesk Enhanced)
|
||||
Description=BetterDesk Signal Server v2.1.1
|
||||
Documentation=https://github.com/UNITRONIX/Rustdesk-FreeConsole
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/rustdesk
|
||||
ExecStart=/opt/rustdesk/hbbs-v8-api -k _
|
||||
ExecStart=/opt/rustdesk/hbbs -r %H -k _ --api-port 21120
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
LimitNOFILE=1000000
|
||||
Environment=RUST_BACKTRACE=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=BetterDesk Console - RustDesk Web Management
|
||||
After=network.target
|
||||
Description=BetterDesk Web Console v2.1.1
|
||||
Documentation=https://github.com/UNITRONIX/Rustdesk-FreeConsole
|
||||
After=network.target rustdesksignal.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
@@ -9,7 +10,9 @@ WorkingDirectory=/opt/BetterDeskConsole
|
||||
Environment="FLASK_HOST=0.0.0.0"
|
||||
Environment="FLASK_PORT=5000"
|
||||
Environment="FLASK_DEBUG=False"
|
||||
ExecStart=/usr/bin/python3 /opt/BetterDeskConsole/app.py
|
||||
Environment="RUSTDESK_PATH=/opt/rustdesk"
|
||||
Environment="API_PORT=21120"
|
||||
ExecStart=/opt/BetterDeskConsole/venv/bin/python /opt/BetterDeskConsole/app.py
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user