mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-07-08 08:26:49 +02:00
80 lines
2.0 KiB
Markdown
80 lines
2.0 KiB
Markdown
The *install-syncthing.ps1* Script
|
|
===========================
|
|
|
|
This PowerShell script installs Syncthing on your computer.
|
|
Syncthing is a continuous file synchronization program. See https://syncthing.net for details.
|
|
|
|
Parameters
|
|
----------
|
|
```powershell
|
|
/Repos/PowerShell/scripts/install-syncthing.ps1 [<CommonParameters>]
|
|
|
|
[<CommonParameters>]
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
```
|
|
|
|
Example
|
|
-------
|
|
```powershell
|
|
PS> ./install-syncthing.ps1
|
|
⏳ Installing Syncthing from WinGet...
|
|
...
|
|
|
|
```
|
|
|
|
Notes
|
|
-----
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
Related Links
|
|
-------------
|
|
navigationLink
|
|
--------------
|
|
{@{uri=Author: Markus Fleschutz | License: CC0}, @{linkText=Author: Markus Fleschutz | License: CC0}}
|
|
|
|
Script Content
|
|
--------------
|
|
```powershell
|
|
<#
|
|
.SYNOPSIS
|
|
Installs Syncthing
|
|
.DESCRIPTION
|
|
This PowerShell script installs Syncthing on your computer.
|
|
Syncthing is a continuous file synchronization program. See https://syncthing.net for details.
|
|
.EXAMPLE
|
|
PS> ./install-syncthing.ps1
|
|
⏳ Installing Syncthing from WinGet...
|
|
...
|
|
.LINK
|
|
Author: Markus Fleschutz | License: CC0
|
|
.NOTES
|
|
https://github.com/fleschutz/PowerShell
|
|
#>
|
|
|
|
try {
|
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
|
|
|
if ($IsLinux) {
|
|
"⏳ Installing Syncthing..."
|
|
& sudo apt install syncthing
|
|
} else {
|
|
"⏳ Installing Syncthing from WinGet..."
|
|
& winget install --id Syncthing.Syncthing --accept-package-agreements --accept-source-agreements
|
|
|
|
"⏳ Starting Syncthing as daemon..."
|
|
Start-Process -NoNewWindow "$env:LOCALAPPDATA\Microsoft\WinGet\Links\syncthing.exe"
|
|
}
|
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
|
"✅ Syncthing installed successfully in $($elapsed)s."
|
|
" Web interface: http://127.0.0.1:8384 (open by: <Ctrl> <click>)"
|
|
" Sync folder at: ~/Sync/ (execute: cd-sync.ps1)"
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error: $($Error[0])"
|
|
exit 1
|
|
}
|
|
```
|
|
|
|
*(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:37)*
|