Skip to content

Commit

Permalink
tailscale-systemd package (#706)
Browse files Browse the repository at this point in the history
* tailscale-systemd package

---------

Co-authored-by: Nathaniel van Diepen <Eeems@users.noreply.github.com>
  • Loading branch information
kiwiz and Eeems committed Jul 26, 2023
1 parent 31139e1 commit 804f80c
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
46 changes: 46 additions & 0 deletions package/tailscale-systemd/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Copyright (c) 2020 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(tailscale-systemd)
pkgdesc="SystemD configuration for tailscale"
url=https://tailscale.com
pkgver=0.0.0-1
section="utils"
timestamp=2023-07-12T00:00Z
maintainer="Kai <z@kwi.li>"
license="BSD 3-Clause"
installdepends=(tailscale)

source=(
tailscaled.service
)
sha256sums=(
SKIP
)

package() {
install -D -m 644 -t "$pkgdir"/etc/systemd/system "$srcdir"/tailscaled.service
}

configure() {
systemctl daemon-reload
systemctl enable tailscaled
systemctl start tailscaled
}

preremove() {
if is-active tailscaled; then
echo "Stopping tailscaled"
systemctl stop tailscaled
fi

if is-enabled tailscaled; then
echo "Disabling tailscaled"
systemctl disable tailscaled
fi
}

postremove() {
systemctl daemon-reload
}
24 changes: 24 additions & 0 deletions package/tailscale-systemd/tailscaled.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[Unit]
Description=Tailscale node agent
Documentation=https://tailscale.com/kb/
Wants=network-pre.target
After=network-pre.target

[Service]
Environment="HOME=/home/root"
ExecStartPre=/opt/bin/tailscaled --cleanup
ExecStart=/opt/bin/tailscaled --state=/opt/var/lib/tailscale/tailscaled.state --socket=/opt/var/run/tailscale/tailscaled.sock --tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055
ExecStopPost=/opt/bin/tailscaled --cleanup

Restart=on-failure

RuntimeDirectory=tailscale
RuntimeDirectoryMode=0755
StateDirectory=tailscale
StateDirectoryMode=0700
CacheDirectory=tailscale
CacheDirectoryMode=0750
Type=notify

[Install]
WantedBy=multi-user.target

0 comments on commit 804f80c

Please sign in to comment.