forked from jgp19684u/frabjous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitea-1.2.3.ebuild
115 lines (90 loc) · 3.1 KB
/
gitea-1.2.3.ebuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
EGO_VENDOR=( "github.com/jteeuwen/go-bindata a0ff256" )
inherit golang-vcs-snapshot systemd user
EGO_PN="code.gitea.io/gitea"
DESCRIPTION="Gitea - Git with a cup of tea"
HOMEPAGE="https://gitea.io"
SRC_URI="https://github.com/go-gitea/gitea/archive/v${PV}.tar.gz -> ${P}.tar.gz
${EGO_VENDOR_URI}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="memcached mysql openssh pam postgres redis sqlite tidb"
RDEPEND="dev-vcs/git[curl,threads]
memcached? ( net-misc/memcached )
mysql? ( virtual/mysql )
openssh? ( net-misc/openssh )
pam? ( virtual/pam )
postgres? ( dev-db/postgresql )
redis? ( dev-db/redis )
sqlite? ( dev-db/sqlite )
tidb? ( dev-db/tidb )"
RESTRICT="mirror strip"
G="${WORKDIR}/${P}"
S="${G}/src/${EGO_PN}"
pkg_setup() {
enewgroup git
enewuser git -1 /bin/bash /var/lib/gitea git
}
src_prepare() {
local GITEA_PREFIX="${EPREFIX}/var/lib/gitea"
sed -i -e "s:^ROOT =:ROOT = ${GITEA_PREFIX}/repos:" \
-e "s:^TEMP_PATH =.*:TEMP_PATH = ${GITEA_PREFIX}/data/tmp/uploads:" \
-e "s:^STATIC_ROOT_PATH =:STATIC_ROOT_PATH = ${EPREFIX}/usr/share/gitea:" \
-e "s:^APP_DATA_PATH =.*:APP_DATA_PATH = ${GITEA_PREFIX}/data:" \
-e "s:^PATH = data/gitea.db:PATH = ${GITEA_PREFIX}/data/gitea.db:" \
-e "s:^ISSUE_INDEXER_PATH =.*:ISSUE_INDEXER_PATH = ${GITEA_PREFIX}/indexers/issues.bleve:" \
-e "s:^PROVIDER_CONFIG =.*:PROVIDER_CONFIG = ${GITEA_PREFIX}/data/sessions:" \
-e "s:^AVATAR_UPLOAD_PATH =.*:AVATAR_UPLOAD_PATH = ${GITEA_PREFIX}/data/avatars:" \
-e "s:^PATH = data/attachments:PATH = ${GITEA_PREFIX}/data/attachments:" \
-e "s:^ROOT_PATH =:ROOT_PATH = ${EPREFIX}/var/log/gitea:" \
conf/app.ini || die
sed -i 's:Version=.*:Version='${PV}'" -X "main.Tags=$(TAGS)":' \
Makefile || die
default
}
src_compile() {
export GOPATH="${G}"
local PATH="${G}/bin:$PATH" TAGS_OPTS=
ebegin "Building go-bindata locally"
pushd vendor/github.com/jteeuwen/go-bindata > /dev/null || die
go build -v -ldflags "-s -w" -o \
"${G}"/bin/go-bindata ./go-bindata || die
popd > /dev/null || die
eend $?
use pam && TAGS_OPTS+=" pam"
use sqlite && TAGS_OPTS+=" sqlite"
use tidb && TAGS_OPTS+=" tidb"
TAGS="${TAGS_OPTS/ /}" \
emake generate build
}
src_test() {
go test -v $(go list ./... | grep -v /integrations) || die
}
src_install() {
dobin gitea
newinitd "${FILESDIR}"/${PN}.initd-r3 ${PN}
systemd_dounit "${FILESDIR}"/${PN}.service
systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd-r1 ${PN}.conf
insinto /var/lib/gitea
doins -r options
insinto /var/lib/gitea/conf
newins conf/app.ini app.ini.example
insinto /usr/share/gitea
doins -r {public,templates}
insinto /etc/logrotate.d
newins "${FILESDIR}"/${PN}.logrotate ${PN}
diropts -m 0750
dodir /var/lib/gitea/data /var/log/gitea
fowners -R git:git /var/{lib,log}/gitea
}
pkg_postinst() {
if [ ! -e "${EROOT%/}"/var/lib/gitea/conf/app.ini ]; then
elog "No app.ini found, copying the example over"
cp "${EROOT%/}"/var/lib/gitea/conf/app.ini{.example,} || die
else
elog "app.ini found, please check example file for possible changes"
fi
}