diff options
| author | Muhammad Moinur Rahman <bofh@FreeBSD.org> | 2025-03-04 08:31:34 +0000 |
|---|---|---|
| committer | Muhammad Moinur Rahman <bofh@FreeBSD.org> | 2025-03-04 08:34:08 +0000 |
| commit | 01be9f77279fef9ebc7190a2a2f9f9626ef251d1 (patch) | |
| tree | d6c8d37e944645bbe2f155552120e424eb3876b7 | |
| parent | 618d3f5a99f7ef10936b0babedc15fe616824fbb (diff) | |
devel/gitea-act_runner: Refactor
- Add act_runner user and group
- Install sample config
- Add rc script
Thanks to Anish for the pointers.
Sponsored by: The FreeBSD Foundation
| -rw-r--r-- | GIDs | 2 | ||||
| -rw-r--r-- | UIDs | 2 | ||||
| -rw-r--r-- | devel/gitea-act_runner/Makefile | 16 | ||||
| -rw-r--r-- | devel/gitea-act_runner/files/act_runner.in | 52 | ||||
| -rw-r--r-- | devel/gitea-act_runner/pkg-message | 9 | ||||
| -rw-r--r-- | devel/gitea-act_runner/pkg-plist | 3 |
6 files changed, 80 insertions, 4 deletions
@@ -747,7 +747,7 @@ clickhouse:*:800: # free: 803 # free: 804 # free: 805 -# free: 806 +act_runner:*:806: bosun:*:807: clixon:*:808: # free: 809 @@ -753,7 +753,7 @@ clickhouse:*:800:800::0:0:ClickHouse Daemon:/var/db/clickhouse:/usr/sbin/nologin # free: 803 # free: 804 # free: 805 -# free: 806 +act_runner:*:806:806::0:0:Act Runner User:/var/db/act_runner:/usr/sbin/nologin bosun:*:807:807::0:0:Bosun Daemon:/nonexistent:/usr/sbin/nologin clixon:*:808:808::0:0:Clixon Daemon:/nonexistent:/usr/sbin/nologin # free: 809 diff --git a/devel/gitea-act_runner/Makefile b/devel/gitea-act_runner/Makefile index 1d6b77cbe475..9d4fb25950f4 100644 --- a/devel/gitea-act_runner/Makefile +++ b/devel/gitea-act_runner/Makefile @@ -1,7 +1,7 @@ PORTNAME= act_runner DISTVERSIONPREFIX= v DISTVERSION= 0.2.11 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= devel PKGNAMEPREFIX= gitea- @@ -13,8 +13,20 @@ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE USES= go:1.23,modules +USE_RC_SUBR= ${PORTNAME} + GO_MODULE= gitea.com/gitea/act_runner -PLIST_FILES= bin/${PORTNAME} +DATADIR= /var/db/${PORTNAME} + +USERS= ${ACT_RUNNER_USER} +GROUPS= ${ACT_RUNNER_GROUP} + +ACT_RUNNER_USER?= ${PORTNAME} +ACT_RUNNER_GROUP?= ${PORTNAME} + +post-install: + ${MKDIR} ${STAGEDIR}${DATADIR} ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${BUILD_WRKSRC}/internal/pkg/config/config.example.yaml ${STAGEDIR}${ETCDIR}/act_runner.conf.sample .include <bsd.port.mk> diff --git a/devel/gitea-act_runner/files/act_runner.in b/devel/gitea-act_runner/files/act_runner.in new file mode 100644 index 000000000000..fa243278cc7e --- /dev/null +++ b/devel/gitea-act_runner/files/act_runner.in @@ -0,0 +1,52 @@ +#!/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"} + +procname="%%PREFIX%%/bin/act_runner" +command="${procname} ${act_runner_flags}" + +pidfile="/var/run/${name}.pid" + +start_cmd="${name}_start" +sig_stop=KILL + +act_runner_start() { + # 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 +} + +run_rc_command "$1" diff --git a/devel/gitea-act_runner/pkg-message b/devel/gitea-act_runner/pkg-message new file mode 100644 index 000000000000..7f6b6e6d8c9f --- /dev/null +++ b/devel/gitea-act_runner/pkg-message @@ -0,0 +1,9 @@ +[ +{ type: install + message: <<EOM +FreeBSD does not support Docker. +When configuring the runner, use 'host' as the label. e.g. +act-runner register --labels FreeBSD:host,FreeBSD-14.2:host +EOM +} +] diff --git a/devel/gitea-act_runner/pkg-plist b/devel/gitea-act_runner/pkg-plist new file mode 100644 index 000000000000..a56480528e5e --- /dev/null +++ b/devel/gitea-act_runner/pkg-plist @@ -0,0 +1,3 @@ +bin/act_runner +@sample %%ETCDIR%%/act_runner.conf.sample +@dir(%%ACT_RUNNER_USER%%,%%ACT_RUNNER_GROUP%%,750) %%DATADIR%% |
