diff --git a/www-apps/gitea/Manifest b/www-apps/gitea/Manifest new file mode 100644 index 0000000..650e64c --- /dev/null +++ b/www-apps/gitea/Manifest @@ -0,0 +1,6 @@ +AUX app.ini 67 BLAKE2B 4ec7b8217486047b419202b3a8a7172ac21ae0e5ad9224cd4f010be730ac5cda9d05bf06dcba2d06f8809900094b3b007ef98dd4ea20a125fb7d3db279f53e4a SHA512 93f6f7cf49dd1ece56f7da711adbb58cc38a503527aeea140837d74456ee6f550a089e897d9cb94382e1eb3f5a5cbe4a61362534463eada08a91f314da0f2108 +AUX gitea.confd 74 BLAKE2B 656800d35c8f0075005e7e9e5c804292f9884663f89f653426064a20cfbcb518f736bd94947a03bce5adad670fb6150d93026999d6d5395f37a85666b6663a2f SHA512 3e05bad19cd924c4375d9ca6fc57142ba4b5ec897a1c789c3fc9710dfcfee209a199c95040eece089ad93e0357486ab98fad0c448a61e318646b7a71845e9a25 +AUX gitea.initd-r1 688 BLAKE2B eb2341dee53f3fd92c49137855615d9ae7ca77efc396e2d2ed8b624ed2776c7522455a469c00172ecbbe2151ccab476baa0c779baf8a39f63348bdc7ebbd29c2 SHA512 4a6bba463c9abafcb6fc9f3854efd1a69fb3b213c2b34ff6a233f90db535c2ab0f375a0809e4c4be6651ed60d7696a54148a5ee9192567d70ca6a5203a8d3266 +AUX gitea.service 472 BLAKE2B 4c728e2987d0c0a86e65d4b9c1a59f6193ff8a3f9b066991a06f495ad1c5586b3497c71fca1cce5b65f167af09343e7bf3215ee5e8fdefa539e384198d2d88d6 SHA512 6666fe3b4cdbb78a58db4a6bf47a15e6be9ab30b666c6eb77a9e8a002d8c0abd510fc75ef463a11ee6892ab12c98943774616072cb64fd9f2fa42ff8f676aa95 +DIST gitea-1.7.5.tar.gz 20855842 BLAKE2B 0455b1a467c9323ee0b5f2bb572cd3388bbf9462a28b6b8d1c87f2baab7da15b1be033d43a6c9cade34cb0c03b841fcb3f5fe42d16fb6bf3ce5c6bea72b0983f SHA512 baa917570bdfb4db86e3a2a666ba5e1e3d6fec245ece675f80a2949d15356534a8b82e29ade7c9f5add99d9a132ebf5dbf7405fec6cb07ca8ba83debb846233f +EBUILD gitea-1.7.5.ebuild 2012 BLAKE2B 362f2e876cb489cef8f30bd6587f194be57c985159f53df4ea9273f9e764377b35c1173089a1f1b26dcc2eea6931b1fadb594717eda1980d93b88d5c4a2835a6 SHA512 c7ec4ba8b929327a7503ec47f95a3ee6ab4a802e04d545e6dfcfe2f56d8bcfd82bb9dc50e4c121833a97dc98b9f141243f857227e3dba8a79d80a95fe4cc8615 diff --git a/www-apps/gitea/files/app.ini b/www-apps/gitea/files/app.ini new file mode 100644 index 0000000..5dd998f --- /dev/null +++ b/www-apps/gitea/files/app.ini @@ -0,0 +1,4 @@ +[log] +MODE = file +LEVEL = Info +ROOT_PATH = /var/log/gitea diff --git a/www-apps/gitea/files/gitea.confd b/www-apps/gitea/files/gitea.confd new file mode 100644 index 0000000..8b1710b --- /dev/null +++ b/www-apps/gitea/files/gitea.confd @@ -0,0 +1,2 @@ +# arguments for gitea +command_args="--config /var/lib/gitea/conf/app.ini" diff --git a/www-apps/gitea/files/gitea.initd-r1 b/www-apps/gitea/files/gitea.initd-r1 new file mode 100644 index 0000000..837164a --- /dev/null +++ b/www-apps/gitea/files/gitea.initd-r1 @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 2016-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Gitea, a self-hosted Git service" +pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"} +user=${user:-git} +group=${group:-git} + +command="/usr/bin/gitea web" +command_args="${command_args:--config /var/lib/gitea/conf/app.ini}" +command_background="true" +start_stop_daemon_args="--user ${user} --group ${group} \ + -e GITEA_WORK_DIR=/var/lib/gitea + --stdout /var/log/${SVCNAME}/${SVCNAME}.log \ + --stderr /var/log/${SVCNAME}/${SVCNAME}.log" + +depend() { + need net + after net +} + +start_pre() { + checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}" +} diff --git a/www-apps/gitea/files/gitea.service b/www-apps/gitea/files/gitea.service new file mode 100644 index 0000000..3fdbc1f --- /dev/null +++ b/www-apps/gitea/files/gitea.service @@ -0,0 +1,26 @@ +[Unit] +Description=Gitea service +Documentation=https://gitea.io + +AssertPathIsDirectory=/var/lib/gitea +AssertPathIsReadWrite=/var/lib/gitea + +After=network.target +Requires=network.target +After=mysqld.service +Requires=mysqld.service + +[Service] +User=git +Group=git + +Environment="GITEA_CUSTOM=/var/lib/gitea" +WorkingDirectory=/var/lib/gitea +ExecStart=/usr/bin/gitea web -c /var/lib/gitea/conf/app.ini + +Restart=always +PrivateTmp=true +Nice=5 + +[Install] +WantedBy=multi-user.target diff --git a/www-apps/gitea/gitea-1.7.5.ebuild b/www-apps/gitea/gitea-1.7.5.ebuild new file mode 100644 index 0000000..6508562 --- /dev/null +++ b/www-apps/gitea/gitea-1.7.5.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit golang-build golang-vcs-snapshot systemd user + +EGO_PN="code.gitea.io/gitea" +KEYWORDS="~amd64 ~arm" + +DESCRIPTION="A painless self-hosted Git service, written in Go" +HOMEPAGE="https://github.com/go-gitea/gitea" +SRC_URI="https://github.com/go-gitea/gitea/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" + +DEPEND=" + dev-go/go-bindata + sys-libs/pam +" +RDEPEND=" + dev-vcs/git + sys-libs/pam +" + +pkg_setup() { + enewgroup git + enewuser git -1 /bin/bash /var/lib/gitea git +} + +src_prepare() { + default + sed -i -e "s/\"main.Version.*$/\"main.Version=${PV}\"/"\ + -e "s/-ldflags '-s/-ldflags '/" src/${EGO_PN}/Makefile || die +} + +src_compile() { + GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" emake -C src/${EGO_PN} generate + TAGS="bindata pam sqlite" LDFLAGS="" CGO_LDFLAGS="" GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" emake -C src/${EGO_PN} build +} + +src_install() { + diropts -m0750 -o git -g git + keepdir /var/log/gitea /var/lib/gitea /var/lib/gitea/data + pushd src/${EGO_PN} >/dev/null || die + dobin gitea + insinto /var/lib/gitea/conf + newins custom/conf/app.ini.sample app.ini.example + popd >/dev/null || die + newinitd "${FILESDIR}"/gitea.initd-r1 gitea + newconfd "${FILESDIR}"/gitea.confd gitea + systemd_dounit "${FILESDIR}/gitea.service" +} + +pkg_postinst() { + if [[ ! -e "${EROOT}/var/lib/gitea/conf/app.ini" ]]; then + elog "No app.ini found, copying initial config over" + cp "${FILESDIR}"/app.ini "${EROOT}"/var/lib/gitea/conf/ || die + chown git:git /var/lib/gitea/conf/app.ini + elog "Please make sure that your 'git' user has the correct homedir (/var/lib/gitea)." + else + elog "app.ini found, please check example file for possible changes" + ewarn "Please note that environment variables have been changed:" + ewarn "GITEA_WORK_DIR is set to /var/lib/gitea (previous value: unset)" + ewarn "GITEA_CUSTOM is set to '\$GITEA_WORK_DIR/custom' (previous: /var/lib/gitea)" + fi +}