1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit fcaps golang-base golang-vcs-snapshot systemd user
8 EGO_PN="github.com/hashicorp/${PN}"
9 VAULT_WEBUI_ARCHIVE="${P}-webui.tar.xz"
10 DESCRIPTION="A tool for managing secrets"
11 HOMEPAGE="https://vaultproject.io/"
12 SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
14 mirror://gentoo/${VAULT_WEBUI_ARCHIVE}
15 https://dev.gentoo.org/~zmedico/dist/${VAULT_WEBUI_ARCHIVE}
18 LICENSE="MPL-2.0 Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT"
24 DEPEND=">=dev-lang/go-1.11:=
28 -m 755 'cap_ipc_lock=+ep' usr/bin/${PN}
32 golang-vcs-snapshot_src_unpack
34 # The webui assets build has numerous nodejs dependencies,
35 # see https://github.com/hashicorp/vault/blob/master/ui/README.md
36 pushd "${S}/src/${EGO_PN}" >/dev/null || die
37 unpack "${VAULT_WEBUI_ARCHIVE}"
44 # Avoid the need to have a git checkout
45 sed -e 's:^\(GIT_COMMIT=\).*:\1:' \
46 -e 's:^\(GIT_DIRTY=\).*:\1:' \
47 -e s:\'\${GIT_COMMIT}\${GIT_DIRTY}\':: \
48 -i src/${EGO_PN}/scripts/build.sh || die
50 -e 's|^\([[:space:]]*\)goimports .*)|\1true|' \
51 -i src/${EGO_PN}/Makefile || die
53 # Avoid network-sandbox violations since go-1.13
54 rm src/${EGO_PN}/go.mod || die
59 enewuser ${PN} -1 -1 -1 ${PN}
64 export -n GOCACHE XDG_CACHE_HOME #678970
65 export GOBIN=${S}/bin GOPATH=${S}
66 cd src/${EGO_PN} || die
67 # The fmt target may need to be executed if it was previously
68 # executed by an older version of go (bug 665438).
70 BUILD_TAGS="$(usex webui ui '')" \
71 XC_ARCH=$(go env GOARCH) \
72 XC_OS=$(go env GOOS) \
73 XC_OSARCH=$(go env GOOS)/$(go env GOARCH) \
78 dodoc src/${EGO_PN}/{CHANGELOG.md,CONTRIBUTING.md,README.md}
79 newinitd "${FILESDIR}/${PN}.initd" "${PN}"
80 newconfd "${FILESDIR}/${PN}.confd" "${PN}"
81 insinto /etc/logrotate.d
82 newins "${FILESDIR}/${PN}.logrotated" "${PN}"
83 systemd_dounit "${FILESDIR}/${PN}.service"
87 doins "${FILESDIR}/"*.json.example
89 keepdir /var/log/${PN}
90 fowners ${PN}:${PN} /var/log/${PN}