vault-0.5.3.ebuild 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit fcaps golang-vcs-snapshot systemd user
  5. EGO_PN="github.com/hashicorp/${PN}/..."
  6. DESCRIPTION="A tool for managing secrets"
  7. HOMEPAGE="https://vaultproject.io/"
  8. SRC_URI="https://${EGO_PN%/*}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
  9. SLOT="0"
  10. LICENSE="MPL-2.0"
  11. KEYWORDS="~amd64"
  12. IUSE=""
  13. RESTRICT="test"
  14. DEPEND=""
  15. RDEPEND=""
  16. STRIP_MASK="*.a"
  17. S="${WORKDIR}/${P}"
  18. FILECAPS=(
  19. -m 755 'cap_ipc_lock=+ep' usr/bin/${PN}
  20. )
  21. pkg_setup() {
  22. enewgroup ${PN}
  23. enewuser ${PN} -1 -1 -1 ${PN}
  24. }
  25. src_compile() {
  26. GOPATH=${S} GO15VENDOREXPERIMENT=1 \
  27. go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die
  28. }
  29. src_install() {
  30. local x
  31. dodoc "${S}"/src/${EGO_PN%/*}/{CHANGELOG.md,CONTRIBUTING.md,README.md}
  32. newinitd "${FILESDIR}/${PN}.initd" "${PN}"
  33. newconfd "${FILESDIR}/${PN}.confd" "${PN}"
  34. insinto /etc/logrotate.d
  35. newins "${FILESDIR}/${PN}.logrotated" "${PN}"
  36. systemd_dounit "${FILESDIR}/${PN}.service"
  37. keepdir /etc/${PN}.d
  38. insinto /etc/${PN}.d
  39. doins "${FILESDIR}/"*.json.example
  40. keepdir /var/log/${PN}
  41. fowners ${PN}:${PN} /var/log/${PN}
  42. dobin "${S}/bin/${PN}"
  43. rm -rf "${S}"/{src,pkg/$(go env GOOS)_$(go env GOARCH)}/${EGO_PN%/*}/vendor
  44. find "${S}"/src/${EGO_PN%/*} -mindepth 1 -maxdepth 1 -type f -delete || die
  45. while read -r -d '' x; do
  46. x=${x#${S}/src}
  47. [[ -d ${S}/pkg/$(go env GOOS)_$(go env GOARCH)/${x} ||
  48. -f ${S}/pkg/$(go env GOOS)_$(go env GOARCH)/${x}.a ]] && continue
  49. rm -rf "${S}"/src/${x}
  50. done < <(find "${S}"/src/${EGO_PN%/*} -mindepth 1 -maxdepth 1 -type d -print0)
  51. insopts -m0644 -p # preserve timestamps for bug 551486
  52. insinto $(dirname "$(get_golibdir)/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}")
  53. doins -r "${S}"/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}
  54. insinto $(dirname "$(get_golibdir)/src/${EGO_PN%/*}")
  55. doins -r "${S}"/src/${EGO_PN%/*}
  56. }