blob: 29ef650c427df6bba50baae6f8148858106a54c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# Copyright 2020-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module linux-info shell-completion systemd sysroot tmpfiles
# They should be updated on every bump.
VERSION_GIT_HASH="41cb72f27119f95b859335f3ffc3434d6ca55e23"
VERSION_MINOR=$(ver_cut 2)
VERSION_SHORT=${PV}
VERSION_LONG=${PV}-t${VERSION_GIT_HASH::9}
DESCRIPTION="Tailscale vpn client"
HOMEPAGE="https://tailscale.com"
SRC_URI="https://github.com/tailscale/tailscale/archive/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://github.com/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-vendor.tar.xz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~arm arm64 ~ppc64 ~riscv ~x86"
RESTRICT="test"
CONFIG_CHECK="~TUN"
RDEPEND="|| ( net-firewall/iptables net-firewall/nftables )"
BDEPEND=">=dev-lang/go-1.26.1"
src_compile() {
# This translates the build command from upstream's build_dist.sh to an
# ebuild equivalent.
local go_ldflags=(
-X tailscale.com/version.longStamp=${VERSION_LONG}
-X tailscale.com/version.shortStamp=${VERSION_SHORT}
-X tailscale.com/version.gitCommitStamp=${VERSION_GIT_HASH}
)
ego build -tags xversion -ldflags "${go_ldflags[*]}" -o bin/ ./cmd/tailscale ./cmd/tailscaled
einfo "generating shell completion files"
sysroot_try_run_prefixed ./bin/tailscale completion bash > ${PN}.bash || die
sysroot_try_run_prefixed ./bin/tailscale completion zsh > ${PN}.zsh || die
sysroot_try_run_prefixed ./bin/tailscale completion fish > ${PN}.fish || die
}
src_install() {
dosbin bin/tailscaled
dobin bin/tailscale
systemd_dounit cmd/tailscaled/{tailscaled.service,tailscale-online.target,tailscale-wait-online.service}
insinto /etc/default
newins cmd/tailscaled/tailscaled.defaults tailscaled
keepdir /var/lib/${PN}
fperms 0750 /var/lib/${PN}
newtmpfiles "${FILESDIR}/${PN}.tmpfiles" ${PN}.conf
newinitd "${FILESDIR}/${PN}d.initd" ${PN}
newconfd "${FILESDIR}/${PN}d.confd" ${PN}
[[ -s ${PN}.bash ]] && newbashcomp ${PN}.bash ${PN}
[[ -s ${PN}.zsh ]] && newzshcomp ${PN}.zsh _${PN}
[[ -s ${PN}.fish ]] && dofishcomp ${PN}.fish
}
pkg_postinst() {
tmpfiles_process ${PN}.conf
}
|