1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit fcaps golang-base systemd user
8 EGO_PN="github.com/hashicorp/${PN}/..."
9 DESCRIPTION="A tool for managing secrets"
10 HOMEPAGE="https://vaultproject.io/"
11 SRC_URI="https://${EGO_PN%/*}/archive/v${PV}.tar.gz -> ${P}.tar.gz
12 https://github.com/mitchellh/gox/archive/c9740af9c6574448fd48eb30a71f964014c7a837.tar.gz -> gox-c9740af9c6574448fd48eb30a71f964014c7a837.tar.gz
13 https://github.com/mitchellh/iochan/archive/87b45ffd0e9581375c491fef3d32130bb15c5bd7.tar.gz -> iochan-87b45ffd0e9581375c491fef3d32130bb15c5bd7.tar.gz
22 DEPEND=">=dev-lang/go-1.7:="
26 -m 755 'cap_ipc_lock=+ep' usr/bin/${PN}
29 get_archive_go_package() {
30 local archive=${1} uri x
31 for x in ${SRC_URI}; do
32 if [[ ${x} == http* ]]; then
34 elif [[ ${x} == ${archive} ]]; then
39 echo ${uri%/archive/*}
42 unpack_go_packages() {
44 # Unpack packages to appropriate locations for GOPATH
47 if [[ ${x} == *.tar.gz ]]; then
48 go_package=$(get_archive_go_package ${x})
49 mkdir -p src/${go_package%/*}
50 mv ${go_package##*/}-* src/${go_package} || die
56 mkdir "${S}" && cd "${S}" || die
62 # Avoid the need to have a git checkout
63 sed -e 's:^\(GIT_COMMIT=\).*:\1:' \
64 -e 's:^\(GIT_DIRTY=\).*:\1:' \
65 -e s:\'\${GIT_COMMIT}\${GIT_DIRTY}\':: \
66 -i src/${EGO_PN%/*}/scripts/build.sh || die
71 enewuser ${PN} -1 -1 -1 ${PN}
76 go install -v -work -x ${EGO_BUILD_FLAGS} "github.com/mitchellh/gox/..." || die
77 cd "${S}"/src/${EGO_PN%/*} || die
78 PATH=${PATH}:${S}/bin \
79 XC_ARCH=$(go env GOARCH) \
80 XC_OS=$(go env GOOS) \
81 XC_OSARCH=$(go env GOOS)/$(go env GOARCH) \
86 dodoc "${S}"/src/${EGO_PN%/*}/{CHANGELOG.md,CONTRIBUTING.md,README.md}
87 newinitd "${FILESDIR}/${PN}.initd" "${PN}"
88 newconfd "${FILESDIR}/${PN}.confd" "${PN}"
89 insinto /etc/logrotate.d
90 newins "${FILESDIR}/${PN}.logrotated" "${PN}"
91 systemd_dounit "${FILESDIR}/${PN}.service"
95 doins "${FILESDIR}/"*.json.example
97 keepdir /var/log/${PN}
98 fowners ${PN}:${PN} /var/log/${PN}
100 dobin "${S}/bin/${PN}"