#!/bin/sh
#
# $NetBSD: gitea.sh,v 1.6 2026/05/26 01:01:15 khorben Exp $
#
# PROVIDE: gitea
# REQUIRE: DAEMON
#
# You will need to set some variables in /etc/rc.conf to start gitea:
#
# gitea=YES

$_rc_subr_loaded . /etc/rc.subr

name="gitea"
rcvar=${name}
required_files="/usr/pkg/etc/gitea/conf/app.ini"
command="/usr/pkg/sbin/gitea"
command_args="--config /usr/pkg/etc/gitea/conf/app.ini web > /dev/null &"

gitea_env="GITEA_WORK_DIR=/usr/pkg/share/gitea"
gitea_env="${gitea_env} GITEA_CUSTOM=/usr/pkg/etc/gitea"
gitea_env="${gitea_env} HOME=/var/db/gitea"
gitea_env="${gitea_env} PATH=$PATH:/usr/pkg/bin"
gitea_env="${gitea_env} USER=git"

gitea_user="git"
gitea_group="git"

cd /

load_rc_config $name
run_rc_command "$1"
