CI / Lint (push) Failing after 9m35s
CI / Test (push) Failing after 6m4s
CI / Build (darwin/amd64) (push) Skipped
CI / Build (linux/amd64) (push) Skipped
CI / Build (windows/amd64) (push) Skipped
CI / Build (darwin/arm64) (push) Skipped
CI / Build (linux/arm64) (push) Skipped
CI / Build (windows/arm64) (push) Skipped
CI / Release (push) Skipped
102 lines
4.0 KiB
PowerShell
102 lines
4.0 KiB
PowerShell
# clip-sync install.ps1
|
|
# One-liner install on Windows (PowerShell):
|
|
#
|
|
# irm https://git.dracodev.net/Projets/clip-sync/raw/branch/main/install.ps1 | iex
|
|
#
|
|
# Detects architecture, downloads the binary, installs to
|
|
# %LOCALAPPDATA%\clip-sync\bin, adds it to PATH, and creates a default config.
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$Version = if ($env:CLIP_SYNC_VERSION) { $env:CLIP_SYNC_VERSION } else { 'latest' }
|
|
$Repo = 'https://git.dracodev.net/Projets/clip-sync'
|
|
$ApiBase = 'https://git.dracodev.net/api/v1/repos/Projets/clip-sync'
|
|
|
|
# ── Resolve version ───────────────────────────────────────────────────
|
|
|
|
if ($Version -eq 'latest') {
|
|
try {
|
|
$release = Invoke-RestMethod "$ApiBase/releases/latest" -UseBasicParsing
|
|
$Version = $release.tag_name
|
|
if (-not $Version) { throw 'no tag_name' }
|
|
} catch {
|
|
throw "clip-sync: no release found. Publish one (git tag v0.2.0 && git push origin v0.2.0), or build from source: git clone $Repo && cd clip-sync && make install"
|
|
}
|
|
}
|
|
|
|
# ── Detect architecture ───────────────────────────────────────────────
|
|
|
|
$arch = switch ($env:PROCESSOR_ARCHITECTURE) {
|
|
'AMD64' { 'amd64' }
|
|
'ARM64' { 'arm64' }
|
|
'x86' { 'amd64' } # 32-bit Windows runs the amd64 binary under WoW64/emulation
|
|
default { throw "clip-sync: unsupported architecture: $env:PROCESSOR_ARCHITECTURE" }
|
|
}
|
|
|
|
$binName = "clip-sync-windows-$arch.exe"
|
|
$url = "$Repo/releases/download/$Version/$binName"
|
|
|
|
$installDir = Join-Path $env:LOCALAPPDATA 'clip-sync\bin'
|
|
$exePath = Join-Path $installDir 'clip-sync.exe'
|
|
|
|
# ── Download ──────────────────────────────────────────────────────────
|
|
|
|
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
|
|
Write-Host "clip-sync: downloading $url"
|
|
|
|
try {
|
|
Invoke-WebRequest -Uri $url -OutFile $exePath -UseBasicParsing
|
|
} catch {
|
|
Write-Host "clip-sync: download failed. Try building from source:" -ForegroundColor Red
|
|
Write-Host " git clone $Repo && cd clip-sync && make install"
|
|
throw
|
|
}
|
|
|
|
# ── Add to PATH ───────────────────────────────────────────────────────
|
|
|
|
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
|
|
if ($userPath -split ';' -notcontains $installDir) {
|
|
[Environment]::SetEnvironmentVariable('Path', "$userPath;$installDir", 'User')
|
|
$env:Path += ";$installDir"
|
|
Write-Host "clip-sync: added $installDir to PATH (restart your terminal to use it)"
|
|
} else {
|
|
$env:Path += ";$installDir"
|
|
}
|
|
|
|
# ── Create default config ─────────────────────────────────────────────
|
|
|
|
$configDir = Join-Path $env:USERPROFILE '.config\clip-sync'
|
|
$configFile = Join-Path $configDir 'peers.toml'
|
|
|
|
if (-not (Test-Path $configFile)) {
|
|
New-Item -ItemType Directory -Force -Path $configDir | Out-Null
|
|
@'
|
|
# clip-sync peers configuration
|
|
# %USERPROFILE%\.config\clip-sync\peers.toml
|
|
|
|
[daemon]
|
|
port = 9137
|
|
poll_interval_ms = 500
|
|
# discovery = true # enable mDNS auto-discovery of peers
|
|
# notify = true # enable desktop notifications
|
|
# sync_images = true # sync images from the clipboard (PNG)
|
|
# receive_files = true # accept incoming file transfers
|
|
|
|
[security]
|
|
# shared_key = "..." # generate with: clip-sync --generate-key
|
|
|
|
# Add your peers here:
|
|
# [[peers]]
|
|
# name = "example"
|
|
# addr = "192.168.1.x:9137"
|
|
'@ | Set-Content -Path $configFile -Encoding UTF8
|
|
Write-Host "clip-sync: created default config at $configFile"
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "clip-sync: installation complete!" -ForegroundColor Green
|
|
Write-Host " 1. Edit $configFile to add your peers"
|
|
Write-Host " 2. Run: clip-sync"
|
|
Write-Host ""
|
|
Write-Host " For service installation, see README.md"
|