Thu Nov 18 02:45:29 2021 UTC ()
gitea: let the RC script work unprivileged

This takes advantage of the introduction of the SYSCONFBASE variable.
Tested on NetBSD/amd64.

While there, also fix a couple substitutions in the default configuration file
(app.ini).

Bumps PKGREVISION.


(khorben)
diff -r1.60 -r1.61 pkgsrc/www/gitea/Makefile
diff -r1.1 -r1.2 pkgsrc/www/gitea/files/app.ini.sample
diff -r1.3 -r1.4 pkgsrc/www/gitea/files/gitea.sh

cvs diff -r1.60 -r1.61 pkgsrc/www/gitea/Makefile (expand / switch to unified diff)

--- pkgsrc/www/gitea/Makefile 2021/11/05 20:02:49 1.60
+++ pkgsrc/www/gitea/Makefile 2021/11/18 02:45:29 1.61
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.60 2021/11/05 20:02:49 bsiegert Exp $ 1# $NetBSD: Makefile,v 1.61 2021/11/18 02:45:29 khorben Exp $
2 2
3DISTNAME= gitea-1.13.4 3DISTNAME= gitea-1.13.4
4PKGREVISION= 10 4PKGREVISION= 11
5MASTER_SITES= ${MASTER_SITE_GITHUB:=go-gitea/} 5MASTER_SITES= ${MASTER_SITE_GITHUB:=go-gitea/}
6CATEGORIES= www 6CATEGORIES= www
7GITHUB_TAG= v${PKGVERSION_NOREV} 7GITHUB_TAG= v${PKGVERSION_NOREV}
8 8
9MAINTAINER= tuxillo@quantumachine.net 9MAINTAINER= tuxillo@quantumachine.net
10HOMEPAGE= https://gitea.io/ 10HOMEPAGE= https://gitea.io/
11COMMENT= Compact self-hosted Git service 11COMMENT= Compact self-hosted Git service
12LICENSE= mit 12LICENSE= mit
13 13
14GO_DIST_BASE= ${DISTNAME} 14GO_DIST_BASE= ${DISTNAME}
15GO_SRCPATH= code.gitea.io/gitea 15GO_SRCPATH= code.gitea.io/gitea
16 16
17# 17#
@@ -64,27 +64,27 @@ PKG_SYSCONFSUBDIR= gitea @@ -64,27 +64,27 @@ PKG_SYSCONFSUBDIR= gitea
64 64
65INSTALLATION_DIRS+= sbin share/gitea share/examples/gitea 65INSTALLATION_DIRS+= sbin share/gitea share/examples/gitea
66 66
67PKG_GROUPS= ${GITEA_GROUP} 67PKG_GROUPS= ${GITEA_GROUP}
68PKG_USERS= ${GITEA_USER}:${GITEA_GROUP} 68PKG_USERS= ${GITEA_USER}:${GITEA_GROUP}
69 69
70PKG_SHELL.${GITEA_USER}= ${SH} 70PKG_SHELL.${GITEA_USER}= ${SH}
71PKG_HOME.${GITEA_USER}= ${VARBASE}/db/gitea 71PKG_HOME.${GITEA_USER}= ${VARBASE}/db/gitea
72 72
73SUBST_CLASSES+= fix-var 73SUBST_CLASSES+= fix-var
74SUBST_STAGE.fix-var= pre-configure 74SUBST_STAGE.fix-var= pre-configure
75SUBST_MESSAGE.fix-var= Replace some vars 75SUBST_MESSAGE.fix-var= Replace some vars
76SUBST_FILES.fix-var= ${WRKDIR}/app.ini.sample 76SUBST_FILES.fix-var= ${WRKDIR}/app.ini.sample
77SUBST_VARS.fix-var= VARBASE GITEA_USER 77SUBST_VARS.fix-var= PKG_SYSCONFDIR VARBASE GITEA_USER
78 78
79CONF_FILES_PERMS+= ${EGDIR}/app.ini.sample ${PKG_SYSCONFDIR}/conf/app.ini \ 79CONF_FILES_PERMS+= ${EGDIR}/app.ini.sample ${PKG_SYSCONFDIR}/conf/app.ini \
80 ${GITEA_USER} ${GITEA_GROUP} 0600 80 ${GITEA_USER} ${GITEA_GROUP} 0600
81 81
82FILES_SUBST+= GITEA_USER=${GITEA_USER} 82FILES_SUBST+= GITEA_USER=${GITEA_USER}
83FILES_SUBST+= GITEA_GROUP=${GITEA_GROUP} 83FILES_SUBST+= GITEA_GROUP=${GITEA_GROUP}
84FILES_SUBST+= GITEA_USER_HOME=${VARBASE}/db/gitea 84FILES_SUBST+= GITEA_USER_HOME=${VARBASE}/db/gitea
85FILES_SUBST+= GITEA_SHARE_DIR=${PREFIX}/share/gitea 85FILES_SUBST+= GITEA_SHARE_DIR=${PREFIX}/share/gitea
86 86
87RCD_SCRIPTS+= gitea 87RCD_SCRIPTS+= gitea
88 88
89MAKE_ENV+= TAGS="${GO_TAGS}" 89MAKE_ENV+= TAGS="${GO_TAGS}"
90 90

cvs diff -r1.1 -r1.2 pkgsrc/www/gitea/files/app.ini.sample (expand / switch to unified diff)

--- pkgsrc/www/gitea/files/app.ini.sample 2019/03/24 21:34:23 1.1
+++ pkgsrc/www/gitea/files/app.ini.sample 2021/11/18 02:45:29 1.2
@@ -7,27 +7,27 @@ @@ -7,27 +7,27 @@
7# 7#
8# This sample configuration runs Gitea with a local database. Before 8# This sample configuration runs Gitea with a local database. Before
9# running this configuration, make sure to change the SECRET_KEY and the 9# running this configuration, make sure to change the SECRET_KEY and the
10# INTERNAL_TOKEN at the end of this file. SECRET_KEY is a password of your 10# INTERNAL_TOKEN at the end of this file. SECRET_KEY is a password of your
11# choosing, INTERNAL_TOKEN is a 64-byte random number in BASE64 encoding.  11# choosing, INTERNAL_TOKEN is a 64-byte random number in BASE64 encoding.
12# Your can generate the token using for example: 12# Your can generate the token using for example:
13# openssl rand -base64 64 13# openssl rand -base64 64
14# 14#
15# There are no pre-configured users; the first user to register becomes an 15# There are no pre-configured users; the first user to register becomes an
16# admin. In this sample configuration, the HTTP server only listens on 16# admin. In this sample configuration, the HTTP server only listens on
17# localhost. 17# localhost.
18# 18#
19# If you'd rather use the web-based installer, remove this conf/app.ini file 19# If you'd rather use the web-based installer, remove this conf/app.ini file
20# and make %%PREFIX%%/etc/gitea/conf writeable to the git user. 20# and make @PKG_SYSCONFDIR@/gitea/conf writeable to the @GITEA_USER@ user.
21 21
22APP_NAME = Gitea: Git with a cup of tea 22APP_NAME = Gitea: Git with a cup of tea
23RUN_USER = @GITEA_USER@ 23RUN_USER = @GITEA_USER@
24RUN_MODE = prod 24RUN_MODE = prod
25 25
26[database] 26[database]
27DB_TYPE = sqlite3 27DB_TYPE = sqlite3
28HOST = 127.0.0.1:3306 28HOST = 127.0.0.1:3306
29NAME = gitea 29NAME = gitea
30PASSWD =  30PASSWD =
31PATH = @VARBASE@/db/gitea/gitea.db 31PATH = @VARBASE@/db/gitea/gitea.db
32SSL_MODE = disable 32SSL_MODE = disable
33USER = root 33USER = root

cvs diff -r1.3 -r1.4 pkgsrc/www/gitea/files/gitea.sh (expand / switch to unified diff)

--- pkgsrc/www/gitea/files/gitea.sh 2021/03/01 23:47:09 1.3
+++ pkgsrc/www/gitea/files/gitea.sh 2021/11/18 02:45:29 1.4
@@ -1,21 +1,25 @@ @@ -1,21 +1,25 @@
1#!@RCD_SCRIPTS_SHELL@ 1#!@RCD_SCRIPTS_SHELL@
2# 2#
3# $NetBSD: gitea.sh,v 1.3 2021/03/01 23:47:09 khorben Exp $ 3# $NetBSD: gitea.sh,v 1.4 2021/11/18 02:45:29 khorben Exp $
4# 4#
5# PROVIDE: gitea 5# PROVIDE: gitea
6# REQUIRE: DAEMON 6# REQUIRE: DAEMON
 7#
 8# You will need to set some variables in @SYSCONFBASE@/rc.conf to start gitea:
 9#
 10# gitea=YES
7 11
8. /etc/rc.subr 12$_rc_subr_loaded . @SYSCONFBASE@/rc.subr
9 13
10name="gitea" 14name="gitea"
11rcvar=${name} 15rcvar=${name}
12required_files="@PKG_SYSCONFDIR@/conf/app.ini" 16required_files="@PKG_SYSCONFDIR@/conf/app.ini"
13command="@PREFIX@/sbin/gitea" 17command="@PREFIX@/sbin/gitea"
14command_args="--config @PKG_SYSCONFDIR@/conf/app.ini web > /dev/null &" 18command_args="--config @PKG_SYSCONFDIR@/conf/app.ini web > /dev/null &"
15 19
16gitea_env="GITEA_WORK_DIR=@GITEA_SHARE_DIR@" 20gitea_env="GITEA_WORK_DIR=@GITEA_SHARE_DIR@"
17gitea_env="${gitea_env} GITEA_CUSTOM=@PKG_SYSCONFDIR@" 21gitea_env="${gitea_env} GITEA_CUSTOM=@PKG_SYSCONFDIR@"
18gitea_env="${gitea_env} HOME=@GITEA_USER_HOME@" 22gitea_env="${gitea_env} HOME=@GITEA_USER_HOME@"
19gitea_env="${gitea_env} USER=@GITEA_USER@" 23gitea_env="${gitea_env} USER=@GITEA_USER@"
20 24
21gitea_user="@GITEA_USER@" 25gitea_user="@GITEA_USER@"