From nobody Fri Jan 13 07:19:32 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NtXq86yHGz2r6j6; Fri, 13 Jan 2023 07:19:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NtXq86Xbyz4PR9; Fri, 13 Jan 2023 07:19:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673594372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wSqxSXSXljyNTKDaTsG7pl8wpukNzlT6ovoyfr+4tfQ=; b=GqqRZoWEidwQGhixDwfXmjEkAqb49sGK3NUMWwbgADxs3RigF6RO9aoSvibKF+LLsOpjvO +XL4akL0WFt1QkbhCHUc4GEHtY5y6dhmgJFu2EKEherTgYaLtEfJhma0rGTfAkebhibu3v uGwYBKRMvCUpg9I3exGzFEXUYkxHilsJdMnXhCuDmRFVKKUWjZpz8VppBgQWCHGGVKd/vo QUhV3KAPURsNZ+cbzXewcRWh5tGP4rU7u9FKdIwyFhlobCavgeUURJGsb6AwjF/64Z9FKO vdAFq24PqQBXOnvmbZQ3cjXNuiNapBXi4RoGaJrwCyI9azYs5gaNyZbBlcCM3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673594372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wSqxSXSXljyNTKDaTsG7pl8wpukNzlT6ovoyfr+4tfQ=; b=RXamhuYsIIRZXi4KY7M5dq/d5rmjeTZUfKP/q/p6eKnbN6fc709JYBR77T5Cq0QhV2cTZy uv9WwNaNVtOzkS09wGP4yi++Qq6UCTtT2iYnXJxv+coZtvF2lv7MljI8Z8ienTmcuqYZ0U BC1nu4RqJBmFdYHFpeamGkhcHiwTxRQcwUAoLB6Dtivkwk0gwWIqbcLq/chLx3ejphTKc8 l4/WH3IUqSONurS1ShU5bJOBfWIfryODIPvM7bJjZfqoKL2taRvaVupbvKgw5glf4dxN7H RLt3dXh2xIohEhKXR4uslFuHtVvmJhYrEiBtoFn/0ZhJgx7hph5hRG0QKV4YkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673594372; a=rsa-sha256; cv=none; b=qdx4oJSN3YFXZpCQhBv4bxaybs4U1ijKmP5YwQQjadYS6iQlkj7sJDQStLFBq/7EV0CPfE frE7mp70zLHEkLlLb9V8WExebU4+8iDrJNZfUQL9reONI8ZdeXEfO80svWEKkK/wDdr/6O nuUOfzNb//wisHkhlIZKRMW5uYB1HJGWl49THz9ziQ9mNgxD9OZT4thN0QPWMXYrUmu9ok qSkXaqQQ8X1pQ6bo8Lu0dLtgJqpMzwWR25twohiocuuhNWksfC6edS3sBlk8CJQRxGMrEi nnky659XNgb9OP6GzSVz52gOMJvwpZn5OuYSr0aDsxxTlQgU4s/QHInntCmgEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NtXq85fGQzyhr; Fri, 13 Jan 2023 07:19:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30D7JWVY023555; Fri, 13 Jan 2023 07:19:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30D7JWbR023554; Fri, 13 Jan 2023 07:19:32 GMT (envelope-from git) Date: Fri, 13 Jan 2023 07:19:32 GMT Message-Id: <202301130719.30D7JWbR023554@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 95bf6629820c - main - www/adguardhome: Make AdGuardHome to write files into a dedicated directory List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95bf6629820c81523de4693a7c6299ed62c7e1f6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=95bf6629820c81523de4693a7c6299ed62c7e1f6 commit 95bf6629820c81523de4693a7c6299ed62c7e1f6 Author: Tobias Bölz AuthorDate: 2023-01-13 07:16:44 +0000 Commit: Yuri Victorovich 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"