diff --git a/devel/forgejo-runner/Makefile b/devel/forgejo-runner/Makefile index e6d42253f9e9..5fd06b3c52e3 100644 --- a/devel/forgejo-runner/Makefile +++ b/devel/forgejo-runner/Makefile @@ -1,41 +1,45 @@ PORTNAME= act_runner DISTVERSIONPREFIX= v DISTVERSION= 9.1.0 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= devel PKGNAMEPREFIX= forgejo- PATCH_SITES= https://code.forgejo.org/forgejo/runner/commit/ PATCHFILES= 34731a41be456d5b6328d8c118ba8e0b6c6a226b.diff:-p1 MAINTAINER= daniel@morante.net COMMENT= Act runner is a runner for Forgejo based on the Gitea Act runner WWW= https://code.forgejo.org/forgejo/runner LICENSE= MIT APACHE20 LICENSE_COMB= multi LICENSE_FILE_APACHE20= ${WRKSRC}/act/container/DOCKER_LICENSE LICENSE_FILE_MIT= ${WRKSRC}/LICENSE USES= go:modules USE_RC_SUBR= ${PORTNAME} GO_MODULE= code.forgejo.org/forgejo/runner/v9 GO_BUILDFLAGS= -ldflags "${LD_FLAG_STRING}" LD_FLAG_STRING= -s ${LD_FLAG_X_PREFIX}.version=${DISTVERSION} LD_FLAG_X_PREFIX= -X ${GO_MODULE}/internal/pkg/ver DATADIR= /var/db/${PORTNAME} -USERS= ${ACT_RUNNER_USER} -GROUPS= ${ACT_RUNNER_GROUP} - ACT_RUNNER_USER?= ${PORTNAME} ACT_RUNNER_GROUP?= ${PORTNAME} +.if ${ACT_RUNNER_USER} == ${PORTNAME} +USERS= ${ACT_RUNNER_USER} +.endif +.if ${ACT_RUNNER_GROUP} == ${PORTNAME} +GROUPS= ${ACT_RUNNER_GROUP} +.endif post-install: ${MKDIR} ${STAGEDIR}${DATADIR} ${STAGEDIR}${ETCDIR} - ${INSTALL_DATA} ${BUILD_WRKSRC}/internal/pkg/config/config.example.yaml ${STAGEDIR}${ETCDIR}/act_runner.conf.sample + ${INSTALL_DATA} ${BUILD_WRKSRC}/internal/pkg/config/config.example.yaml \ + ${STAGEDIR}${ETCDIR}/act_runner.conf.sample .include diff --git a/devel/forgejo-runner/files/act_runner.in b/devel/forgejo-runner/files/act_runner.in index fa243278cc7e..7bb6e2a96978 100644 --- a/devel/forgejo-runner/files/act_runner.in +++ b/devel/forgejo-runner/files/act_runner.in @@ -1,52 +1,55 @@ #!/bin/sh # PROVIDE: act_runner # REQUIRE: NETWORKING SYSLOG # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable act_runner: # # act_runner_enable (bool): Set to "NO" by default. # Set it to "YES" to enable act_runner. . /etc/rc.subr name="act_runner" rcvar="act_runner_enable" load_rc_config "${name}" : ${act_runner_user:="act_runner"} : ${act_runner_enable:="NO"} : ${act_runner_facility:="daemon"} : ${act_runner_priority:="debug"} : ${act_runner_config:="%%ETCDIR%%/act_runner.conf"} : ${act_runner_cache_dir:="%%DATADIR%%"} : ${act_runner_log_dir:="/var/log/act_runner"} : ${act_runner_log_file:="${act_runner_log_dir}/act_runner.log"} -: ${act_runner_flags:="-c ${act_runner_config} daemon"} +: ${act_runner_args:="-c ${act_runner_config} daemon"} -procname="%%PREFIX%%/bin/act_runner" -command="${procname} ${act_runner_flags}" +command="/usr/sbin/daemon" pidfile="/var/run/${name}.pid" +exec_path="%%PREFIX%%/bin/act_runner" -start_cmd="${name}_start" -sig_stop=KILL +required_files=${act_runner_config} -act_runner_start() { +prestart_cmd="${name}_prestart" +sig_stop=TERM + +act_runner_prestart() { # ensure the log directories are owned by the unprivileged user for d in "${act_runner_log_dir}"; do if [ ! -e "$d" ]; then mkdir "$d" chown "${act_runner_user}" "$d" fi done - /usr/sbin/daemon -S -l "${act_runner_facility}" -s "${act_runner_priority}" \ - -T "${name}" \ - -u "${act_runner_user}" -p "${pidfile}" \ - -o "${act_runner_log_file}" \ - $command } +command_args=" -r -S -l ${act_runner_facility} -s ${act_runner_priority} \ + -T ${name} \ + -u ${act_runner_user} -P ${pidfile} \ + -o ${act_runner_log_file} \ + ${exec_path} ${act_runner_args}" + run_rc_command "$1"