[Bug 268890] www/adguardhome: adguardhome writes files to /usr/local/bin/
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Jan 2023 17:30:26 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268890 Bug ID: 268890 Summary: www/adguardhome: adguardhome writes files to /usr/local/bin/ Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: yuri@freebsd.org Reporter: freebsd-bugs@boelz.eu Assignee: yuri@freebsd.org Flags: maintainer-feedback?(yuri@freebsd.org) When starting the adguardhome service after installing the port or package, it writes an AdGuardHome.yaml config file, a data directory, and possibly other files to /usr/local/bin/. This is because AdGuard Home defaults to the directory of the binary for both its config file and working directory. Here is a patch that adds variables with reasonable defaults for adguardhome’s config and work-dir arguments to the rc.d script: ``` diff --git a/www/adguardhome/Makefile b/www/adguardhome/Makefile index aa0996e711ef..b329ee41c71b 100644 --- a/www/adguardhome/Makefile +++ b/www/adguardhome/Makefile @@ -27,7 +27,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" ``` -- You are receiving this mail because: You are the assignee for the bug.