Gentoo Linux Overlay
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

66 行
2.0KB

  1. # Copyright 1999-2018 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit user systemd golang-build golang-vcs-snapshot
  5. EGO_PN="code.gitea.io/gitea"
  6. KEYWORDS="~amd64 ~arm"
  7. DESCRIPTION="A painless self-hosted Git service, written in Go"
  8. HOMEPAGE="https://github.com/go-gitea/gitea"
  9. SRC_URI="https://github.com/go-gitea/gitea/archive/v1.7.3.tar.gz -> ${P}.tar.gz"
  10. LICENSE="MIT"
  11. SLOT="0"
  12. IUSE=""
  13. DEPEND="dev-go/go-bindata"
  14. RDEPEND="dev-vcs/git"
  15. pkg_setup() {
  16. enewgroup git
  17. enewuser git -1 /bin/bash /var/lib/gitea git
  18. }
  19. src_prepare() {
  20. default
  21. sed -i -e "s/\"main.Version.*$/\"main.Version=${PV}\"/"\
  22. -e "s/-ldflags '-s/-ldflags '/" src/${EGO_PN}/Makefile || die
  23. }
  24. src_compile() {
  25. GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" emake -C src/${EGO_PN} generate
  26. TAGS="bindata pam sqlite" LDFLAGS="" CGO_LDFLAGS="-fno-PIC" GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" emake -C src/${EGO_PN} build
  27. }
  28. src_install() {
  29. mkdir -p ${D}/var/lib/gitea/custom
  30. pushd src/${EGO_PN} || die
  31. cp -apr options ${D}/var/lib/gitea/custom/
  32. cp -apr public ${D}/var/lib/gitea/custom/
  33. cp -apr templates ${D}/var/lib/gitea/custom/
  34. dobin gitea
  35. insinto /var/lib/gitea/conf
  36. newins custom/conf/app.ini.sample app.ini.example
  37. popd || die
  38. newinitd "${FILESDIR}"/gitea.initd-r1 gitea
  39. newconfd "${FILESDIR}"/gitea.confd gitea
  40. keepdir /var/log/gitea /var/lib/gitea/data
  41. fowners -R git:git /var/log/gitea /var/lib/gitea/
  42. systemd_dounit "${FILESDIR}/gitea.service"
  43. }
  44. pkg_postinst() {
  45. if [[ ! -e "${EROOT}/var/lib/gitea/conf/app.ini" ]]; then
  46. elog "No app.ini found, copying initial config over"
  47. cp "${FILESDIR}"/app.ini "${EROOT}"/var/lib/gitea/conf/ || die
  48. chown git:git /var/lib/gitea/conf/app.ini
  49. else
  50. elog "app.ini found, please check example file for possible changes"
  51. ewarn "Please note that environment variables have been changed:"
  52. ewarn "GITEA_WORK_DIR is set to /var/lib/gitea (previous value: unset)"
  53. ewarn "GITEA_CUSTOM is set to '\$GITEA_WORK_DIR/custom' (previous: /var/lib/gitea)"
  54. fi
  55. }