feat: add installation scripts and update documentation for downloading WebDrop Bridge releases
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
This commit is contained in:
parent
6d052e221b
commit
1dcce081f1
5 changed files with 690 additions and 1 deletions
|
|
@ -108,7 +108,75 @@ tox -e type
|
||||||
tox
|
tox
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building
|
### Installing from Release (wget)
|
||||||
|
|
||||||
|
Download pre-built installers from Forgejo releases using **wget** (useful for enterprise deployments, automated scripts, or initial setup before the built-in update mechanism):
|
||||||
|
|
||||||
|
#### Simplest: Direct wget (if you know the version)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Replace VERSION with release tag (e.g., v0.8.0)
|
||||||
|
wget https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/VERSION/WebDropBridge_Setup.msi
|
||||||
|
|
||||||
|
# Real example - download v0.8.0 MSI
|
||||||
|
wget https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/v0.8.0/WebDropBridge_Setup.msi
|
||||||
|
|
||||||
|
# macOS - download v0.8.0 DMG
|
||||||
|
wget https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/v0.8.0/WebDropBridge_Setup.dmg
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Windows (PowerShell) - Full Control Script
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Download latest release
|
||||||
|
.\build\scripts\download_release.ps1
|
||||||
|
|
||||||
|
# Download to specific directory
|
||||||
|
.\build\scripts\download_release.ps1 -OutputDir "C:\Installers"
|
||||||
|
|
||||||
|
# Download specific version
|
||||||
|
.\build\scripts\download_release.ps1 -Version "0.8.0"
|
||||||
|
|
||||||
|
# Skip checksum verification
|
||||||
|
.\build\scripts\download_release.ps1 -Verify $false
|
||||||
|
```
|
||||||
|
|
||||||
|
**Prerequisites**: `wget` (install via `choco install wget` or `winget install GNU.Wget`)
|
||||||
|
|
||||||
|
#### macOS / Linux (Bash) - Full Control Script
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Download latest release to current directory
|
||||||
|
./build/scripts/download_release.sh
|
||||||
|
|
||||||
|
# Download to specific directory
|
||||||
|
./build/scripts/download_release.sh latest ~/Downloads
|
||||||
|
|
||||||
|
# Download specific version
|
||||||
|
./build/scripts/download_release.sh 0.8.0
|
||||||
|
|
||||||
|
# Skip checksum verification
|
||||||
|
./build/scripts/download_release.sh latest --no-verify
|
||||||
|
```
|
||||||
|
|
||||||
|
**Prerequisites**: `wget` (install via `brew install wget` on macOS or `apt-get install wget` on Linux)
|
||||||
|
|
||||||
|
#### Alternative Methods
|
||||||
|
|
||||||
|
**With checksum verification (grep/cut, no jq required):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Get latest and download with automatic checksum verification
|
||||||
|
wget -qO- https://git.him-tools.de/api/v1/repos/HIM-public/webdrop-bridge/releases/latest | \
|
||||||
|
grep -o '"browser_download_url":"[^"]*\.\(msi\|dmg\)"' | head -1 | cut -d'"' -f4 | \
|
||||||
|
xargs wget -O installer.msi
|
||||||
|
```
|
||||||
|
|
||||||
|
**Via web browser:**
|
||||||
|
|
||||||
|
Simply visit https://git.him-tools.de/HIM-public/webdrop-bridge/releases and download directly
|
||||||
|
|
||||||
|
### Building from Source
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Windows MSI
|
# Windows MSI
|
||||||
|
|
|
||||||
24
README.md
24
README.md
|
|
@ -38,6 +38,30 @@ WebDrop Bridge embeds a web application in a Qt container with full filesystem a
|
||||||
- Windows 10/11
|
- Windows 10/11
|
||||||
- 200 MB disk space (includes Chromium from PyInstaller)
|
- 200 MB disk space (includes Chromium from PyInstaller)
|
||||||
|
|
||||||
|
### Installation from Pre-Built Release (Recommended)
|
||||||
|
|
||||||
|
**Simplest Method: Direct wget (if you know the version)**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Replace VERSION with release tag (e.g., v0.8.0)
|
||||||
|
wget https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/VERSION/WebDropBridge_Setup.msi
|
||||||
|
|
||||||
|
# Example for v0.8.0:
|
||||||
|
wget https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/v0.8.0/WebDropBridge_Setup.msi
|
||||||
|
```
|
||||||
|
|
||||||
|
**Alternative: Automated script (auto-detects platform)**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Windows (PowerShell)
|
||||||
|
.\build\scripts\download_release.ps1
|
||||||
|
|
||||||
|
# macOS / Linux
|
||||||
|
./build/scripts/download_release.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
For more installation options and details, see [QUICKSTART.md](QUICKSTART.md#installing-from-release-wget)
|
||||||
|
|
||||||
### Installation from Source
|
### Installation from Source
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
197
build/scripts/README.md
Normal file
197
build/scripts/README.md
Normal file
|
|
@ -0,0 +1,197 @@
|
||||||
|
# Build Scripts
|
||||||
|
|
||||||
|
Automation scripts for building, releasing, and downloading WebDrop Bridge.
|
||||||
|
|
||||||
|
## Scripts Overview
|
||||||
|
|
||||||
|
| Script | Purpose | OS |
|
||||||
|
|--------|---------|-----|
|
||||||
|
| `download_release.ps1` | Download installer from Forgejo via wget | Windows |
|
||||||
|
| `download_release.sh` | Download installer from Forgejo via wget | macOS/Linux |
|
||||||
|
| `build_windows.py` | Build Windows MSI installer | Windows |
|
||||||
|
| `build_macos.sh` | Build macOS DMG installer | macOS |
|
||||||
|
| `create_release.ps1` | Create GitHub/Forgejo release | Windows |
|
||||||
|
| `create_release.sh` | Create GitHub/Forgejo release | macOS/Linux |
|
||||||
|
| `sync_remotes.ps1` | Sync git remotes | Windows |
|
||||||
|
| `sync_version.py` | Manage version synchronization | All |
|
||||||
|
|
||||||
|
## Download Scripts
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
|
||||||
|
The `download_release.ps1` (Windows) and `download_release.sh` (macOS/Linux) scripts download pre-built WebDrop Bridge installers from the Forgejo repository using **wget**. This is the recommended way to:
|
||||||
|
|
||||||
|
- **Initial Installation**: First-time users can bootstrap without building from source
|
||||||
|
- **Enterprise Deployments**: Automated setup scripts in larger organizations
|
||||||
|
- **Offline/Air-Gapped Systems**: Download on one machine, transfer to another
|
||||||
|
- **Proxy Environments**: Works with corporate proxies (via wget)
|
||||||
|
- **CI/CD Automation**: Internal deployment pipelines
|
||||||
|
- **Command-Line Preference**: Admins who prefer CLI tools over GUIs
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
✅ **Automatic platform detection** - Prefers .dmg on macOS, .msi on Windows
|
||||||
|
✅ **SHA256 checksum verification** - Ensures integrity of downloaded files
|
||||||
|
✅ **Progress indication** - Shows download progress with wget
|
||||||
|
✅ **Error handling** - Clear error messages for common issues
|
||||||
|
✅ **Version selection** - Download specific releases or latest
|
||||||
|
✅ **Offline-friendly** - Works in environments with limited connectivity
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- **wget** (required)
|
||||||
|
- Windows: `choco install wget` or `winget install GNU.Wget`
|
||||||
|
- macOS: `brew install wget`
|
||||||
|
- Linux: `apt-get install wget` (Ubuntu/Debian) or equivalent
|
||||||
|
|
||||||
|
### Direct wget Commands (No Script Needed)
|
||||||
|
|
||||||
|
**Simplest: If you know the version**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Download directly by version tag
|
||||||
|
wget https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/v0.8.0/WebDropBridge_Setup.msi
|
||||||
|
wget https://git.him-tools.de/HIM-public/webdrop-bridge/releases/download/v0.8.0/WebDropBridge_Setup.dmg
|
||||||
|
```
|
||||||
|
|
||||||
|
**If you need to auto-detect latest (with grep/cut, no jq needed)**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Get latest release and download MSI/DMG
|
||||||
|
wget -qO- https://git.him-tools.de/api/v1/repos/HIM-public/webdrop-bridge/releases/latest | \
|
||||||
|
grep -o '"browser_download_url":"[^"]*\.\(msi\|dmg\)"' | head -1 | cut -d'"' -f4 | \
|
||||||
|
xargs wget -O installer.msi
|
||||||
|
```
|
||||||
|
|
||||||
|
**With checksum verification**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Download installer and checksum
|
||||||
|
INSTALLER=$(wget -qO- https://git.him-tools.de/api/v1/repos/HIM-public/webdrop-bridge/releases/latest | \
|
||||||
|
grep -o '"browser_download_url":"[^"]*\.\(msi\|dmg\)"' | head -1 | cut -d'"' -f4)
|
||||||
|
|
||||||
|
wget -O installer.msi "$INSTALLER"
|
||||||
|
wget -O installer.sha256 "${INSTALLER}.sha256"
|
||||||
|
|
||||||
|
# Verify (macOS: shasum -a 256 -c installer.sha256)
|
||||||
|
sha256sum -c installer.sha256
|
||||||
|
```
|
||||||
|
|
||||||
|
### Script-Based Usage (Recommended for Automation)
|
||||||
|
|
||||||
|
#### Windows PowerShell
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Latest release to current directory
|
||||||
|
.\download_release.ps1
|
||||||
|
|
||||||
|
# Specific version to Downloads folder
|
||||||
|
.\download_release.ps1 -Version "0.8.0" -OutputDir "$env:USERPROFILE\Downloads"
|
||||||
|
|
||||||
|
# Skip checksum verification
|
||||||
|
.\download_release.ps1 -Verify $false
|
||||||
|
```
|
||||||
|
|
||||||
|
#### macOS / Linux Bash
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Latest release
|
||||||
|
./build/scripts/download_release.sh
|
||||||
|
|
||||||
|
# Specific version to Downloads
|
||||||
|
./build/scripts/download_release.sh 0.8.0 ~/Downloads
|
||||||
|
|
||||||
|
# Skip checksum verification
|
||||||
|
./build/scripts/download_release.sh latest --no-verify
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build Scripts
|
||||||
|
|
||||||
|
### build_windows.py
|
||||||
|
Builds Windows MSI installer using PyInstaller and WIX toolset.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python build/scripts/build_windows.py --msi
|
||||||
|
```
|
||||||
|
|
||||||
|
### build_macos.sh
|
||||||
|
Builds macOS DMG installer with code signing and notarization.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash build/scripts/build_macos.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Release Scripts
|
||||||
|
|
||||||
|
### create_release.ps1 / create_release.sh
|
||||||
|
Automated release creation with versioning and asset uploads.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Windows
|
||||||
|
.\build\scripts\create_release.ps1
|
||||||
|
|
||||||
|
# macOS/Linux
|
||||||
|
./build/scripts/create_release.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version Management
|
||||||
|
|
||||||
|
### sync_version.py
|
||||||
|
Manages consistent versioning across the project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python build/scripts/sync_version.py --version 0.8.0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integration Flow
|
||||||
|
|
||||||
|
```
|
||||||
|
download_release.ps1/sh
|
||||||
|
↓
|
||||||
|
Fetches release from Forgejo API
|
||||||
|
↓
|
||||||
|
Downloads installer (.msi or .dmg)
|
||||||
|
↓
|
||||||
|
Verifies SHA256 checksum
|
||||||
|
↓
|
||||||
|
Installer ready for execution
|
||||||
|
↓
|
||||||
|
(Application auto-update handles future updates)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing Scripts Locally
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Test download script (dry-run)
|
||||||
|
.\build\scripts\download_release.ps1 -Version "0.7.1"
|
||||||
|
|
||||||
|
# Test with different output directory
|
||||||
|
.\build\scripts\download_release.ps1 -OutputDir ".\test_download"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### wget not found
|
||||||
|
- **Windows**: Install via `winget install GNU.Wget` or Chocolatey
|
||||||
|
- **macOS**: `brew install wget`
|
||||||
|
- **Linux**: `apt-get install wget` (or equivalent)
|
||||||
|
|
||||||
|
### Checksum verification failed
|
||||||
|
- File may be corrupted in transit
|
||||||
|
- Retry download: `.\download_release.ps1 -Verify $false` then manually verify
|
||||||
|
- Report issue with download URL and Forgejo release info
|
||||||
|
|
||||||
|
### Network timeouts
|
||||||
|
- Check connectivity to `https://git.him-tools.de`
|
||||||
|
- May indicate temporary Forgejo API unavailability
|
||||||
|
- Retry after a few minutes
|
||||||
|
|
||||||
|
### Permission denied (macOS/Linux)
|
||||||
|
```bash
|
||||||
|
chmod +x build/scripts/download_release.sh
|
||||||
|
chmod +x build/scripts/build_macos.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
For user-facing documentation, see [QUICKSTART.md](../../QUICKSTART.md) and [README.md](../../README.md)
|
||||||
192
build/scripts/download_release.ps1
Normal file
192
build/scripts/download_release.ps1
Normal file
|
|
@ -0,0 +1,192 @@
|
||||||
|
#!/usr/bin/env pwsh
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Download WebDrop Bridge release installer from Forgejo via wget.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Fetches the latest (or specified) WebDrop Bridge release from the Forgejo repository
|
||||||
|
and downloads the appropriate installer (MSI for Windows, DMG for macOS) using wget.
|
||||||
|
|
||||||
|
This script is useful for:
|
||||||
|
- Enterprise deployments with proxy requirements
|
||||||
|
- Automated deployment scripts
|
||||||
|
- Initial setup before the built-in update mechanism kicks in
|
||||||
|
- Admins preferring command-line tools for infrastructure automation
|
||||||
|
|
||||||
|
.PARAMETER Version
|
||||||
|
Semantic version to download (e.g., "0.8.0").
|
||||||
|
If not specified, downloads the latest release.
|
||||||
|
Default: "latest"
|
||||||
|
|
||||||
|
.PARAMETER OutputDir
|
||||||
|
Directory to save the downloaded installer.
|
||||||
|
Default: Current directory
|
||||||
|
|
||||||
|
.PARAMETER Verify
|
||||||
|
If $true, verify checksum against .sha256 file from release.
|
||||||
|
Default: $true
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Download latest release to current directory
|
||||||
|
.\download_release.ps1
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Download specific version to Downloads folder
|
||||||
|
.\download_release.ps1 -Version "0.8.0" -OutputDir "$env:USERPROFILE\Downloads"
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Download without checksum verification
|
||||||
|
.\download_release.ps1 -Verify $false
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
Requires wget to be installed and available in PATH.
|
||||||
|
Install via: choco install wget (Chocolatey) or winget install GNU.Wget
|
||||||
|
#>
|
||||||
|
|
||||||
|
param(
|
||||||
|
[string]$Version = "latest",
|
||||||
|
[string]$OutputDir = ".",
|
||||||
|
[bool]$Verify = $true
|
||||||
|
)
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
$ForgejoUrl = "https://git.him-tools.de"
|
||||||
|
$Repo = "HIM-public/webdrop-bridge"
|
||||||
|
$ApiEndpoint = "$ForgejoUrl/api/v1/repos/$Repo/releases/$Version"
|
||||||
|
|
||||||
|
# Ensure output directory exists
|
||||||
|
if (-not (Test-Path $OutputDir)) {
|
||||||
|
New-Item -ItemType Directory -Path $OutputDir -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Resolve to absolute path
|
||||||
|
$OutputDirAbs = (Resolve-Path $OutputDir).Path
|
||||||
|
|
||||||
|
Write-Host "🚀 WebDrop Bridge Download Script" -ForegroundColor Cyan
|
||||||
|
Write-Host "Version: $Version"
|
||||||
|
Write-Host "Output: $OutputDirAbs"
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# Check if wget is installed
|
||||||
|
try {
|
||||||
|
$wgetVersion = (wget --version 2>&1 | Select-Object -First 1)
|
||||||
|
Write-Host "✓ wget found: $wgetVersion" -ForegroundColor Green
|
||||||
|
} catch {
|
||||||
|
Write-Host "❌ wget not found. Install via:" -ForegroundColor Red
|
||||||
|
Write-Host " choco install wget" -ForegroundColor Yellow
|
||||||
|
Write-Host " or" -ForegroundColor Yellow
|
||||||
|
Write-Host " winget install GNU.Wget" -ForegroundColor Yellow
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fetch release info from Forgejo API
|
||||||
|
Write-Host "📥 Fetching release information from Forgejo..." -ForegroundColor Cyan
|
||||||
|
try {
|
||||||
|
$response = Invoke-WebRequest -Uri $ApiEndpoint -UseBasicParsing -ErrorAction Stop
|
||||||
|
$releaseData = ConvertFrom-Json $response.Content
|
||||||
|
} catch {
|
||||||
|
Write-Host "❌ Failed to fetch release info: $_" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $releaseData) {
|
||||||
|
Write-Host "❌ Release not found: $Version" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$TagName = $releaseData.tag_name
|
||||||
|
$ReleaseName = $releaseData.name
|
||||||
|
Write-Host "📦 Found release: $ReleaseName ($TagName)" -ForegroundColor Green
|
||||||
|
|
||||||
|
# Find installer asset (.msi for Windows, .dmg for macOS)
|
||||||
|
$InstallerAsset = $null
|
||||||
|
$Sha256Asset = $null
|
||||||
|
|
||||||
|
foreach ($asset in $releaseData.assets) {
|
||||||
|
$assetName = $asset.name
|
||||||
|
if ($assetName -match '\.(msi|dmg)$') {
|
||||||
|
$InstallerAsset = $asset
|
||||||
|
}
|
||||||
|
if ($assetName -match '\.sha256$') {
|
||||||
|
$Sha256Asset = $asset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $InstallerAsset) {
|
||||||
|
Write-Host "❌ No installer found in release (looking for .msi or .dmg)" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$InstallerName = $InstallerAsset.name
|
||||||
|
$InstallerUrl = $InstallerAsset.browser_download_url
|
||||||
|
$InstallerPath = Join-Path $OutputDirAbs $InstallerName
|
||||||
|
|
||||||
|
Write-Host "💾 Downloading: $InstallerName" -ForegroundColor Cyan
|
||||||
|
Write-Host " URL: $InstallerUrl" -ForegroundColor Gray
|
||||||
|
|
||||||
|
# Download using wget
|
||||||
|
try {
|
||||||
|
& wget -O $InstallerPath $InstallerUrl -q --show-progress
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "wget exited with code $LASTEXITCODE"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "❌ Download failed: $_" -ForegroundColor Red
|
||||||
|
if (Test-Path $InstallerPath) {
|
||||||
|
Remove-Item $InstallerPath -Force
|
||||||
|
}
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "✓ Downloaded: $InstallerPath" -ForegroundColor Green
|
||||||
|
|
||||||
|
# Verify checksum if requested
|
||||||
|
if ($Verify -and $Sha256Asset) {
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "🔍 Verifying checksum..." -ForegroundColor Cyan
|
||||||
|
|
||||||
|
$Sha256Url = $Sha256Asset.browser_download_url
|
||||||
|
$Sha256Path = Join-Path $OutputDirAbs "$InstallerName.sha256"
|
||||||
|
|
||||||
|
try {
|
||||||
|
& wget -O $Sha256Path $Sha256Url -q
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to download checksum"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Read checksum file (format: "hash filename")
|
||||||
|
$checksumContent = Get-Content $Sha256Path
|
||||||
|
$expectedHash = ($checksumContent -split '\s+')[0]
|
||||||
|
|
||||||
|
# Calculate SHA256 of downloaded file
|
||||||
|
$actualHash = (Get-FileHash -Path $InstallerPath -Algorithm SHA256).Hash.ToLower()
|
||||||
|
|
||||||
|
if ($actualHash -eq $expectedHash.ToLower()) {
|
||||||
|
Write-Host "✓ Checksum verified" -ForegroundColor Green
|
||||||
|
} else {
|
||||||
|
Write-Host "❌ Checksum mismatch!" -ForegroundColor Red
|
||||||
|
Write-Host " Expected: $expectedHash" -ForegroundColor Yellow
|
||||||
|
Write-Host " Actual: $actualHash" -ForegroundColor Yellow
|
||||||
|
Remove-Item $InstallerPath -Force
|
||||||
|
Remove-Item $Sha256Path -Force
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Clean up checksum file
|
||||||
|
Remove-Item $Sha256Path -Force
|
||||||
|
} catch {
|
||||||
|
Write-Host "⚠ Checksum verification failed: $_" -ForegroundColor Yellow
|
||||||
|
Write-Host " Installer downloaded but not verified" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
} elseif ($Verify -and -not $Sha256Asset) {
|
||||||
|
Write-Host "⚠ No checksum file in release, skipping verification" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "✅ Download complete!" -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Next steps:" -ForegroundColor Cyan
|
||||||
|
Write-Host " 1. Review: $InstallerPath"
|
||||||
|
Write-Host " 2. Execute installer to install WebDrop Bridge"
|
||||||
|
Write-Host " 3. Launch application and configure paths/URLs in settings"
|
||||||
|
Write-Host ""
|
||||||
208
build/scripts/download_release.sh
Normal file
208
build/scripts/download_release.sh
Normal file
|
|
@ -0,0 +1,208 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# WebDrop Bridge Release Downloader
|
||||||
|
#
|
||||||
|
# Download WebDrop Bridge release installer from Forgejo via wget.
|
||||||
|
# Useful for enterprise deployments, automated scripts, and initial setup.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# ./download_release.sh # Download latest to current dir
|
||||||
|
# ./download_release.sh 0.8.0 # Download specific version
|
||||||
|
# ./download_release.sh latest ~/Downloads # Download to specific directory
|
||||||
|
# ./download_release.sh --no-verify # Skip checksum verification
|
||||||
|
#
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
FORGEJO_URL="https://git.him-tools.de"
|
||||||
|
REPO="HIM-public/webdrop-bridge"
|
||||||
|
VERSION="${1:-latest}"
|
||||||
|
OUTPUT_DIR="${2:-.}"
|
||||||
|
VERIFY_CHECKSUM=true
|
||||||
|
|
||||||
|
# Handle flags
|
||||||
|
if [[ "$VERSION" == "--no-verify" ]]; then
|
||||||
|
VERIFY_CHECKSUM=false
|
||||||
|
VERSION="latest"
|
||||||
|
OUTPUT_DIR="${2:-.}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$VERSION" == "--no-verify" ]]; then
|
||||||
|
VERIFY_CHECKSUM=false
|
||||||
|
VERSION="latest"
|
||||||
|
OUTPUT_DIR="${2:-.}"
|
||||||
|
elif [[ ! "$VERSION" =~ ^[0-9\.a-z-]+$ ]] && [[ "$VERSION" != "latest" ]]; then
|
||||||
|
# Treat any non-version argument as output dir
|
||||||
|
OUTPUT_DIR="$VERSION"
|
||||||
|
VERSION="latest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
CYAN='\033[0;36m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
# Create output directory
|
||||||
|
mkdir -p "$OUTPUT_DIR"
|
||||||
|
OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)"
|
||||||
|
|
||||||
|
echo -e "${CYAN}🚀 WebDrop Bridge Download Script${NC}"
|
||||||
|
echo -e "Version: $VERSION"
|
||||||
|
echo -e "Output: $OUTPUT_DIR"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Check if wget is installed
|
||||||
|
if ! command -v wget &> /dev/null; then
|
||||||
|
echo -e "${RED}❌ wget not found. Install via:${NC}"
|
||||||
|
echo -e "${YELLOW} macOS: brew install wget${NC}"
|
||||||
|
echo -e "${YELLOW} Linux: apt-get install wget (Ubuntu/Debian) or equivalent${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WGET_VERSION=$(wget --version | head -n1)
|
||||||
|
echo -e "${GREEN}✓ wget found: $WGET_VERSION${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Fetch release info from Forgejo API
|
||||||
|
API_ENDPOINT="$FORGEJO_URL/api/v1/repos/$REPO/releases/$VERSION"
|
||||||
|
echo -e "${CYAN}📥 Fetching release information from Forgejo...${NC}"
|
||||||
|
|
||||||
|
RELEASE_JSON=$(wget -q -O - "$API_ENDPOINT" 2>/dev/null || {
|
||||||
|
echo -e "${RED}❌ Failed to fetch release info from $API_ENDPOINT${NC}"
|
||||||
|
exit 1
|
||||||
|
})
|
||||||
|
|
||||||
|
if [[ -z "$RELEASE_JSON" ]]; then
|
||||||
|
echo -e "${RED}❌ Release not found: $VERSION${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Parse JSON (basic shell parsing, suitable for our use case)
|
||||||
|
TAG_NAME=$(echo "$RELEASE_JSON" | grep -o '"tag_name":"[^"]*"' | head -1 | cut -d'"' -f4)
|
||||||
|
RELEASE_NAME=$(echo "$RELEASE_JSON" | grep -o '"name":"[^"]*"' | head -1 | cut -d'"' -f4)
|
||||||
|
|
||||||
|
if [[ -z "$TAG_NAME" ]]; then
|
||||||
|
echo -e "${RED}❌ Failed to parse release information${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${GREEN}📦 Found release: $RELEASE_NAME ($TAG_NAME)${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Find installer asset (.msi for Windows, .dmg for macOS)
|
||||||
|
# Extract all asset names and URLs
|
||||||
|
INSTALLER_NAME=""
|
||||||
|
INSTALLER_URL=""
|
||||||
|
CHECKSUM_URL=""
|
||||||
|
|
||||||
|
# macOS systems prefer .dmg, Windows/.msi
|
||||||
|
SYSTEM=$(uname -s)
|
||||||
|
if [[ "$SYSTEM" == "Darwin" ]]; then
|
||||||
|
# macOS: prefer .dmg
|
||||||
|
INSTALLER_NAME=$(echo "$RELEASE_JSON" | grep -o '"name":"[^"]*\.dmg"' | head -1 | cut -d'"' -f4)
|
||||||
|
if [[ -z "$INSTALLER_NAME" ]]; then
|
||||||
|
# Fallback to .msi if no .dmg
|
||||||
|
INSTALLER_NAME=$(echo "$RELEASE_JSON" | grep -o '"name":"[^"]*\.msi"' | head -1 | cut -d'"' -f4)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Linux/Other: prefer .msi, fallback to .dmg
|
||||||
|
INSTALLER_NAME=$(echo "$RELEASE_JSON" | grep -o '"name":"[^"]*\.msi"' | head -1 | cut -d'"' -f4)
|
||||||
|
if [[ -z "$INSTALLER_NAME" ]]; then
|
||||||
|
INSTALLER_NAME=$(echo "$RELEASE_JSON" | grep -o '"name":"[^"]*\.dmg"' | head -1 | cut -d'"' -f4)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$INSTALLER_NAME" ]]; then
|
||||||
|
echo -e "${RED}❌ No installer found in release (looking for .msi or .dmg)${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract browser_download_url for installer
|
||||||
|
# This is a bit hacky but works for JSON without a full JSON parser
|
||||||
|
INSTALLER_URL=$(echo "$RELEASE_JSON" | \
|
||||||
|
grep -B2 "\"name\":\"$INSTALLER_NAME\"" | \
|
||||||
|
grep -o '"browser_download_url":"[^"]*"' | \
|
||||||
|
cut -d'"' -f4)
|
||||||
|
|
||||||
|
if [[ -z "$INSTALLER_URL" ]]; then
|
||||||
|
echo -e "${RED}❌ Could not extract download URL for $INSTALLER_NAME${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Find checksum URL if verification is enabled
|
||||||
|
if [[ "$VERIFY_CHECKSUM" == "true" ]]; then
|
||||||
|
CHECKSUM_FILENAME="${INSTALLER_NAME}.sha256"
|
||||||
|
CHECKSUM_URL=$(echo "$RELEASE_JSON" | \
|
||||||
|
grep -B2 "\"name\":\"$CHECKSUM_FILENAME\"" | \
|
||||||
|
grep -o '"browser_download_url":"[^"]*"' | \
|
||||||
|
cut -d'"' -f4 || echo "")
|
||||||
|
fi
|
||||||
|
|
||||||
|
INSTALLER_PATH="$OUTPUT_DIR/$INSTALLER_NAME"
|
||||||
|
|
||||||
|
echo -e "${CYAN}💾 Downloading: $INSTALLER_NAME${NC}"
|
||||||
|
echo -e "${CYAN} URL: $INSTALLER_URL${NC}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Download using wget with progress
|
||||||
|
if ! wget -O "$INSTALLER_PATH" "$INSTALLER_URL" --show-progress 2>&1; then
|
||||||
|
echo -e "${RED}❌ Download failed${NC}"
|
||||||
|
[[ -f "$INSTALLER_PATH" ]] && rm -f "$INSTALLER_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}✓ Downloaded: $INSTALLER_PATH${NC}"
|
||||||
|
|
||||||
|
# Verify checksum if requested and available
|
||||||
|
if [[ "$VERIFY_CHECKSUM" == "true" ]] && [[ -n "$CHECKSUM_URL" ]]; then
|
||||||
|
echo ""
|
||||||
|
echo -e "${CYAN}🔍 Verifying checksum...${NC}"
|
||||||
|
|
||||||
|
CHECKSUM_PATH="$OUTPUT_DIR/${INSTALLER_NAME}.sha256"
|
||||||
|
|
||||||
|
if wget -O "$CHECKSUM_PATH" "$CHECKSUM_URL" -q 2>/dev/null; then
|
||||||
|
# Read checksum from file (format: "hash filename")
|
||||||
|
EXPECTED_HASH=$(cut -d' ' -f1 "$CHECKSUM_PATH")
|
||||||
|
|
||||||
|
# Calculate SHA256
|
||||||
|
if command -v sha256sum &> /dev/null; then
|
||||||
|
ACTUAL_HASH=$(sha256sum "$INSTALLER_PATH" | cut -d' ' -f1)
|
||||||
|
elif command -v shasum &> /dev/null; then
|
||||||
|
ACTUAL_HASH=$(shasum -a 256 "$INSTALLER_PATH" | cut -d' ' -f1)
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}⚠ No SHA256 tool available, skipping verification${NC}"
|
||||||
|
ACTUAL_HASH=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$ACTUAL_HASH" ]]; then
|
||||||
|
if [[ "${EXPECTED_HASH,,}" == "${ACTUAL_HASH,,}" ]]; then
|
||||||
|
echo -e "${GREEN}✓ Checksum verified${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}❌ Checksum mismatch!${NC}"
|
||||||
|
echo -e "${YELLOW} Expected: $EXPECTED_HASH${NC}"
|
||||||
|
echo -e "${YELLOW} Actual: $ACTUAL_HASH${NC}"
|
||||||
|
rm -f "$INSTALLER_PATH" "$CHECKSUM_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$CHECKSUM_PATH"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}⚠ Could not download checksum file, skipping verification${NC}"
|
||||||
|
fi
|
||||||
|
elif [[ "$VERIFY_CHECKSUM" == "true" ]]; then
|
||||||
|
echo -e "${YELLOW}⚠ No checksum file in release, skipping verification${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}✅ Download complete!${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${CYAN}Next steps:${NC}"
|
||||||
|
echo -e " 1. Review: $INSTALLER_PATH"
|
||||||
|
echo -e " 2. Execute installer to install WebDrop Bridge"
|
||||||
|
echo -e " 3. Launch application and configure paths/URLs in settings"
|
||||||
|
echo ""
|
||||||
Loading…
Add table
Add a link
Reference in a new issue