summaryrefslogtreecommitdiff
blob: 4b4aeb53e588e9d70c8cd39b658d7ccd0004b0e0 (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
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6
inherit eutils golang-build systemd user

DESCRIPTION="Modern SSH server for teams managing distributed infrastructure"
HOMEPAGE="https://gravitational.com/teleport"

EGO_PN="github.com/gravitational/${PN}/..."

if [[ ${PV} == "9999" ]] ; then
	inherit git-r3 golang-vcs
	EGIT_REPO_URI="https://github.com/gravitational/${PN}.git"
else
	inherit golang-vcs-snapshot
	SRC_URI="https://github.com/gravitational/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64 ~arm"
fi

IUSE=""
LICENSE="Apache-2.0"
RESTRICT="test strip"
SLOT="0"

DEPEND="
	app-arch/zip
	>=dev-lang/go-1.9.2"
RDEPEND=""

src_prepare() {
	default

	sed -i -e 's/-j 3/-j 1/g' src/${EGO_PN%/*}/Makefile
}

src_compile() {
	GOPATH="${S}" emake -j1 -C src/${EGO_PN%/*} full
}

src_install() {
	keepdir /var/lib/${PN} /etc/${PN}
	dobin src/${EGO_PN%/*}/build/{tsh,tctl,teleport}

	insinto /etc/${PN}
	doins "${FILESDIR}"/${PN}.yaml

	newinitd "${FILESDIR}"/${PN}-2.5.init.d ${PN}
	newconfd "${FILESDIR}"/${PN}.conf.d ${PN}

	systemd_newunit "${FILESDIR}"/${PN}-2.5.service ${PN}.service
	systemd_install_serviced "${FILESDIR}"/${PN}.service.conf ${PN}.service
}

src_test() {
	BUILDFLAGS="" GOPATH="${S}" emake -C src/${EGO_PN%/*} test
}