Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
version: "3"

vars:
DOWNLOAD_SYNCTHING_VERSION: "v2.0.3"
DOWNLOAD_SYNCTHING_VERSION: "v2.1.3"

tasks:
download-syncthing:
Expand Down
14 changes: 10 additions & 4 deletions scripts/download-syncthing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ $ErrorActionPreference = "Stop"
$outdir = "syncthing"

if (Test-Path "$outdir/syncthing.exe") {
Write-Host "Syncthing already downloaded in $outdir. Skipping download."
exit 0
$versionOutput = & "$outdir/syncthing.exe" version 2>$null | Select-Object -First 1
$currentVersion = ($versionOutput -split '\s+')[1]
Comment on lines +9 to +10
if ($currentVersion -eq $Version) {
Write-Host "Syncthing $Version already downloaded in $outdir. Skipping download."
exit 0
}

Write-Host "Found Syncthing $currentVersion in $outdir; replacing it with $Version."
}

. "$PSScriptRoot\helpers\get-arch.ps1"
Expand Down Expand Up @@ -39,9 +45,9 @@ Expand-Archive -Path $zipPath -DestinationPath $outdir -Force
# Optionally move binaries up from the nested folder
$extractedRoot = Join-Path $outdir "syncthing-windows-$arch-$Version"
if (Test-Path $extractedRoot) {
Move-Item -Path (Join-Path $extractedRoot '*') -Destination $outdir -Force
Copy-Item -Path (Join-Path $extractedRoot '*') -Destination $outdir -Recurse -Force
Comment on lines 45 to +48
Remove-Item $extractedRoot -Recurse -Force
}

Remove-Item $zipPath -Force
Remove-Item $sigPath -Force
Remove-Item $sigPath -Force