Added install-syncthing.ps1

This commit is contained in:
Markus Fleschutz 2025-05-17 14:03:06 +02:00
parent 3399b4a6df
commit 0cbe8e69c4

View File

@ -0,0 +1,29 @@
<#
.SYNOPSIS
Installs Syncthing
.DESCRIPTION
This PowerShell scripts installs Syncthing on your computer.
.EXAMPLE
PS> ./install-syncthing.ps1
.LINK
Author: Markus Fleschutz | License: CC0
.NOTES
https://github.com/fleschutz/PowerShell
#>
try {
"⏳ Installing Syncthing..."
$stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) {
& sudo apt install syncthing
} else {
& winget install --id Syncthing.Syncthing
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Syncthing installed successfully in $($elapsed)s. Visit 127.0.0.1:8384 for setup and see the ~/Sync folder"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}