git: 95bf6629820c - main - www/adguardhome: Make AdGuardHome to write files into a dedicated directory
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Jan 2023 07:19:32 UTC
The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=95bf6629820c81523de4693a7c6299ed62c7e1f6 commit 95bf6629820c81523de4693a7c6299ed62c7e1f6 Author: Tobias Bölz <freebsd-bugs@boelz.eu> AuthorDate: 2023-01-13 07:16:44 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2023-01-13 07:19:27 +0000 www/adguardhome: Make AdGuardHome to write files into a dedicated directory PR: 268890 --- www/adguardhome/Makefile | 4 +++- www/adguardhome/files/adguardhome.in | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/www/adguardhome/Makefile b/www/adguardhome/Makefile index aa0996e711ef..f9d31deee94f 100644 --- a/www/adguardhome/Makefile +++ b/www/adguardhome/Makefile @@ -1,6 +1,7 @@ PORTNAME= adguardhome DISTVERSIONPREFIX= v DISTVERSION= 0.107.21 +PORTREVISION= 1 CATEGORIES= www MAINTAINER= yuri@FreeBSD.org @@ -27,7 +28,8 @@ GO_BUILDFLAGS= -ldflags="-s -w -X github.com/AdguardTeam/AdGuardHome/internal/v DEV_UPDATE_MODE= no USER= root # it has to run as root because it listens on the privileged DNS port -SUB_LIST= USER=${USER} +GROUP= wheel +SUB_LIST= USER=${USER} GROUP=${GROUP} USE_RC_SUBR= ${PORTNAME} CPE_VENDOR= adguard diff --git a/www/adguardhome/files/adguardhome.in b/www/adguardhome/files/adguardhome.in index 902745da6a35..6a9fd0fb6532 100644 --- a/www/adguardhome/files/adguardhome.in +++ b/www/adguardhome/files/adguardhome.in @@ -14,12 +14,26 @@ rcvar=adguardhome_enable load_rc_config $name -adguardhome_enable=${adguardhome_enable:-"NO"} +: ${adguardhome_enable:=NO} +: ${adguardhome_config:=/usr/local/etc/AdGuardHome.yaml} +: ${adguardhome_user:=%%USER%%} +: ${adguardhome_group:=%%GROUP%%} +: ${adguardhome_work_dir:=/var/db/adguardhome} logfile="/var/log/${name}.log" procname=%%PREFIX%%/bin/adguardhome command="/usr/sbin/daemon" -command_args="-u %%USER%% -o ${logfile} -t ${name} %%PREFIX%%/bin/adguardhome" +command_args="-u ${adguardhome_user} -o ${logfile} -t ${name} %%PREFIX%%/bin/adguardhome -c ${adguardhome_config} -w ${adguardhome_work_dir}" + +start_precmd="${name}_prestart" + +adguardhome_prestart() +{ + if [ ! -d ${adguardhome_work_dir} ]; then + install -d -m 0750 -o ${adguardhome_user} -g ${adguardhome_group} \ + ${adguardhome_work_dir} + fi +} run_rc_command "$1"