mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
add syncthing
This commit is contained in:
70
syncthing/README.md
Normal file
70
syncthing/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: Syncthing
|
||||
homepage: https://syncthing.net/
|
||||
tagline: |
|
||||
Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers.
|
||||
---
|
||||
|
||||
To update or switch versions, run `webi keypairs@stable` (or use `@beta` for
|
||||
pre-releases).
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> Syncthing is like a self-hosted Dropbox or Google Drive. It keeps data safe,
|
||||
> secure, and accessible.
|
||||
|
||||
Once installed you launch the setup like so:
|
||||
|
||||
```bash
|
||||
syncthing
|
||||
```
|
||||
|
||||
You can have multiple syncs and shares. The "Default Folder" is `~/Sync/` (ex:
|
||||
`/Users/me/Sync`).
|
||||
|
||||
Files are updated about every 30 seconds.
|
||||
|
||||
### Basic Setup
|
||||
|
||||
You need to install syncthing on TWO OR MORE devices for it to be effective.
|
||||
|
||||
Go to <http://127.0.0.1:8384/#settings-gui> and make these changes:
|
||||
|
||||
- Actions > Settings > General > Minimum Free Disk Space > 15%
|
||||
- Actions > Settings > GUI > Uncheck "Start Browser"
|
||||
- Default Folder > Edit > File Versioning > Staggared File Versioning
|
||||
- Actions > Show ID > (copy to clipboard)
|
||||
- Remote Devices > Add Remote Device > (paste ID from other computer)
|
||||
- (if you're on the same network you may be able to click to add)
|
||||
- Set the remote computer name
|
||||
- Then go to "Sharing" and select "Default Folder"
|
||||
- Save
|
||||
- NOTE: You will need to accept the device share on the first computer, and
|
||||
then the folder on the second (alternatively you can set Auto-Accept on
|
||||
both)
|
||||
|
||||
You may also want to password protect the local GUI.
|
||||
|
||||
### How to run on Login
|
||||
|
||||
You can use [serviceman](/serviceman) to run syncthing as a user-level service:
|
||||
|
||||
```bash
|
||||
webi serviceman
|
||||
```
|
||||
|
||||
```bash
|
||||
env PATH="$PATH" serviceman add --user --name syncthing -- syncthing
|
||||
```
|
||||
|
||||
Serviceman is cross-platform and will create the correct _launchd_, _systemd_,
|
||||
or Windows Startup config file.
|
||||
|
||||
### Do you need to Port Forward?
|
||||
|
||||
Maybe.
|
||||
|
||||
Syncthing will try to use UPnP. Check your router config and make sure UPnP is
|
||||
enabled.
|
||||
|
||||
Otherwise, yes, forward both UDP and TCP ports 22000.
|
||||
57
syncthing/install.ps1
Normal file
57
syncthing/install.ps1
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
#####################
|
||||
# Install syncthing #
|
||||
#####################
|
||||
|
||||
# Every package should define these variables
|
||||
$pkg_cmd_name = "syncthing"
|
||||
|
||||
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\syncthing.exe"
|
||||
$pkg_dst = "$pkg_dst_cmd"
|
||||
|
||||
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\syncthing-v$Env:WEBI_VERSION\bin\syncthing.exe"
|
||||
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\syncthing-v$Env:WEBI_VERSION\bin"
|
||||
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\syncthing-v$Env:WEBI_VERSION"
|
||||
$pkg_src = "$pkg_src_cmd"
|
||||
|
||||
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
|
||||
|
||||
# Fetch archive
|
||||
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
|
||||
{
|
||||
# TODO: arch detection
|
||||
echo "Downloading syncthing from $Env:WEBI_PKG_URL to $pkg_download"
|
||||
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
|
||||
& move "$pkg_download.part" "$pkg_download"
|
||||
}
|
||||
|
||||
IF (!(Test-Path -Path "$pkg_src_cmd"))
|
||||
{
|
||||
echo "Installing syncthing"
|
||||
|
||||
# TODO: create package-specific temp directory
|
||||
# Enter tmp
|
||||
pushd .local\tmp
|
||||
|
||||
# Remove any leftover tmp cruft
|
||||
Remove-Item -Path ".\syncthing-*" -Recurse -ErrorAction Ignore
|
||||
Remove-Item -Path ".\syncthing.exe" -Recurse -ErrorAction Ignore
|
||||
|
||||
# Unpack archive file into this temporary directory
|
||||
# Windows BSD-tar handles zip. Imagine that.
|
||||
echo "Unpacking $pkg_download"
|
||||
& tar xf "$pkg_download"
|
||||
|
||||
# Settle unpacked archive into place
|
||||
echo "Install Location: $pkg_src_cmd"
|
||||
New-Item "$pkg_src_bin" -ItemType Directory -Force
|
||||
Move-Item -Path ".\syncthing*\syncthing.exe" -Destination "$pkg_src_bin"
|
||||
|
||||
# Exit tmp
|
||||
popd
|
||||
}
|
||||
|
||||
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
|
||||
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore
|
||||
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
|
||||
42
syncthing/install.sh
Normal file
42
syncthing/install.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
function __init_syncthing() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
#####################
|
||||
# Install syncthing #
|
||||
#####################
|
||||
|
||||
# Every package should define these 6 variables
|
||||
pkg_cmd_name="syncthing"
|
||||
|
||||
pkg_dst_cmd="$HOME/.local/bin/syncthing"
|
||||
pkg_dst="$pkg_dst_cmd"
|
||||
|
||||
pkg_src_cmd="$HOME/.local/opt/syncthing-v$WEBI_VERSION/bin/syncthing"
|
||||
pkg_src_dir="$HOME/.local/opt/syncthing-v$WEBI_VERSION"
|
||||
pkg_src="$pkg_src_cmd"
|
||||
|
||||
pkg_install() {
|
||||
# $HOME/.local/opt/syncthing-v1.12.1/bin
|
||||
mkdir -p "$(dirname $pkg_src_cmd)"
|
||||
|
||||
# mv ./syncthing* "$HOME/.local/opt/syncthing-v1.12.1/bin/syncthing"
|
||||
mv ./syncthing*/"$pkg_cmd_name"* "$pkg_src_cmd"
|
||||
|
||||
# chmod a+x "$HOME/.local/opt/syncthing-v1.12.1/bin/syncthing"
|
||||
chmod a+x "$pkg_src_cmd"
|
||||
}
|
||||
|
||||
# pkg_get_current_version is recommended, but (soon) not required
|
||||
pkg_get_current_version() {
|
||||
# 'syncthing version' has output in this format:
|
||||
# syncthing v1.12.1 "Fermium Flea" (go1.15.5 darwin-amd64) teamcity@build.syncthing.net 2020-12-06 12:46:27 UTC
|
||||
# This trims it down to just the version number:
|
||||
# 1.12.1
|
||||
echo "$(syncthing --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')"
|
||||
}
|
||||
}
|
||||
|
||||
__init_syncthing
|
||||
20
syncthing/releases.js
Normal file
20
syncthing/releases.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var github = require('../_common/github.js');
|
||||
var owner = 'syncthing';
|
||||
var repo = 'syncthing';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user