syncthing-installed

Example:

# Install Syncthing for (current) user (into ~/.local/bin).
- syncthing-installed

Description

Download the 'syncthing' binary for the selected architecture/platform and install it.

Variables

Name Type Default Description

arch

string amd64

The architecture of the host system.

dest

string --

The (absolute) path to the parent folder of the downloaded executable file.

force

boolean --

Force overwrite executable if it already exists.

group

string --

The group for the syncthing executable.

owner

string --

The user who runs syncthing.

platform

string linux

The platform of the host system.

version

string 1.2.1

The version of the product.

Examples

Example 1

Install Syncthing for (current) user (into ~/.local/bin).

Code
- syncthing-installed

Example 2

Install Syncthing systemwide (into /usr/local/bin).

Code
- syncthing-installed:
    owner: root
    group: root

Example 3

Install Syncthing systemwide to custom location.

Code
- syncthing-installed:
    owner: root
    group: root
    dest: /opt/syncthing

Code

doc:
  short_help: Download the Syncthing binary.
  help: |
    Download the 'syncthing' binary for the selected architecture/platform and install it.
  examples:
  - title: Install Syncthing for (current) user (into ~/.local/bin).
    vars: {}
  - title: Install Syncthing systemwide (into /usr/local/bin).
    vars:
      owner: root
      group: root
  - title: Install Syncthing systemwide to custom location.
    vars:
      owner: root
      group: root
      dest: /opt/syncthing

args:
  _import: executable-downloaded
  version:
    doc:
      short_help: The version of the product.
    type: string
    required: true
    default: 1.2.1
  arch:
    doc:
      short_help: The architecture of the host system.
    type: string
    required: false
    default: amd64
    allowed:
    - amd64
    - '386'
    - arm
    - arm64
    - mips
    - mips64
    - mipsle
    - ppc64le
    - s390x
  platform:
    doc:
      short_help: The platform of the host system.
    type: string
    required: false
    default: linux
    allowed:
    - linux
    - freebsd
    - darwin
    - openbsd
    - solaris
    - windows
  owner:
    doc:
      short_help: The user who runs syncthing.
    type: string
    required: false
    cli:
      metavar: USER
  group:
    doc:
      short_help: The group for the syncthing executable.
    type: string
    required: false
    cli:
      metavar: GROUP


frecklets:
- executable-downloaded:
    url: 'https://github.com/syncthing/syncthing/releases/download/v{{:: version ::}}/syncthing-{{::
      platform ::}}-{{:: arch ::}}-v{{:: version ::}}.tar.gz'
    dest: '{{:: dest ::}}'
    exe_mode: '0775'
    exe_name: syncthing
    extract_subfolder: 'syncthing-{{:: platform ::}}-{{:: arch ::}}-v{{:: version
      ::}}'
    extract: true
    group: '{{:: group ::}}'
    owner: '{{:: owner ::}}'
    force: '{{:: force ::}}'
frecklecute syncthing-installed --help

Usage: frecklecute syncthing-installed [OPTIONS]

  Download the 'syncthing' binary for the selected architecture/platform and
  install it.

Options:
  --arch ARCH          The architecture of the host system.
  --dest DEST          The (absolute) path to the parent folder of the
                       downloaded executable file.
  -f, --force          Force overwrite executable if it already exists.
  --group GROUP        The group for the syncthing executable.
  --owner USER         The user who runs syncthing.
  --platform PLATFORM  The platform of the host system.
  --version VERSION    The version of the product.
  --help               Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.syncthing_installed.SyncthingInstalled
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class SyncthingInstalled(AutoPycklet):
    """Download the 'syncthing' binary for the selected architecture/platform and install it.

       Args:
         arch: The architecture of the host system.
         dest: The (absolute) path to the parent folder of the downloaded executable file.
         force: Force overwrite executable if it already exists.
         group: The group for the syncthing executable.
         owner: The user who runs syncthing.
         platform: The platform of the host system.
         version: The version of the product.

    """

    FRECKLET_ID = "syncthing-installed"

    arch: str = None
    dest: str = None
    force: bool = None
    group: str = None
    owner: str = None
    platform: str = None
    version: str = None


    def __post_init__(self):
        super(SyncthingInstalled, self).__init__(var_names=["arch", "dest", "force", "group", "owner", "platform", "version"])


frecklet_class = SyncthingInstalled
# -*- coding: utf-8 -*-


#
# module path: pycklets.syncthing_installed.SyncthingInstalled
#


from pyckles import AutoPycklet

class SyncthingInstalled(AutoPycklet):
    """Download the 'syncthing' binary for the selected architecture/platform and install it.

       Args:
         arch: The architecture of the host system.
         dest: The (absolute) path to the parent folder of the downloaded executable file.
         force: Force overwrite executable if it already exists.
         group: The group for the syncthing executable.
         owner: The user who runs syncthing.
         platform: The platform of the host system.
         version: The version of the product.

    """

    FRECKLET_ID = "syncthing-installed"

    def __init__(self, arch="amd64", dest=None, force=None, group=None, owner=None, platform="linux", version="1.2.1"):

        super(SyncthingInstalled, self).__init__(var_names=["arch", "dest", "force", "group", "owner", "platform", "version"])
        self._arch = arch
        self._dest = dest
        self._force = force
        self._group = group
        self._owner = owner
        self._platform = platform
        self._version = version

    @property
    def arch(self):
        return self._arch

    @arch.setter
    def arch(self, arch):
        self._arch = arch

    @property
    def dest(self):
        return self._dest

    @dest.setter
    def dest(self, dest):
        self._dest = dest

    @property
    def force(self):
        return self._force

    @force.setter
    def force(self, force):
        self._force = force

    @property
    def group(self):
        return self._group

    @group.setter
    def group(self, group):
        self._group = group

    @property
    def owner(self):
        return self._owner

    @owner.setter
    def owner(self, owner):
        self._owner = owner

    @property
    def platform(self):
        return self._platform

    @platform.setter
    def platform(self, platform):
        self._platform = platform

    @property
    def version(self):
        return self._version

    @version.setter
    def version(self, version):
        self._version = version



frecklet_class = SyncthingInstalled