From nobody Sun Jan 22 17:42:35 2023 X-Original-To: dev-commits-ports-all@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 4P0LCw250Yz3NGQ4; Sun, 22 Jan 2023 17:42:36 +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 4P0LCw1gbmz3CMm; Sun, 22 Jan 2023 17:42:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674409356; 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=fmHEkMpe0fBMCX7zLTkRtqA8t2HsEbDA4lS4kCgEDlA=; b=WVeBeWWIcENa/hkfflu79WalQNR+SkZvgC5/81keie+jYUSTwDWAke/goI46/X5iQgIGvV WqaR7G8gP3xljHMy1oydEZAnA9yTMQkeD+930BJWHZyoG/14wLDp0j1JYjCXURc7oyfGS7 XxIMz5fSmIf6R3kwxBrHN15yy6QC9l0SNbZ5fMkwTfcYjfSpufK8B9g9lzFpeKi/W2ZjaF iv8FyJwb7XiPB+UDAjCUE1e5P7W4za9h5lf+vnXliPNE5E4nGE+TvAzvi1y+4+ZqiIO7AM mAL9yEp93geuz0bLCdUPu4JcqLbqBvkdxGSJmYTx//zPZmWlj6KoNnqF1ns8zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674409356; 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=fmHEkMpe0fBMCX7zLTkRtqA8t2HsEbDA4lS4kCgEDlA=; b=BMw9f96kKfqKmy7BcI9c+HLvi8LIq/5b1ldx+icAz7Fro92WoxeNCWk/0Qc5NnEWcXBthC xMo4Ic1AXQDlD6T6O5WOVRD1qgj0lMB0ZefaqAOlHsZ811cwCC5DduRhI/JcjE0RMhJsuW EPD/Lo4I7xSZkgTS2tXiWaLfN2UUeTxbiFga/RbYkwhV5tCDU8heMEstrph55yc06SqUQJ bycQh1k2KNVXTXyp1dxknhbG/uaWoJsAtzcHa65b/43P+3kqXxTHhaHMX5jFamzlpt2ML/ g3ixCyHQx7Kyia1o76dx7zOKCXyevsZngwjToMNS3o30qrCYB8Uq3kvXHWf4og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674409356; a=rsa-sha256; cv=none; b=ISQqpXdmWmiFmAS5PNrZtsh/o2zdQ6/78W/cP5ydtXLkFh3zc1yj3uLR8szUiv9/RfD9lg XxoFHGC9MjjpBPT9mu6MdPfCtgksKe9DAndCinTKb4R321NeFglwbIUDlVRm3Ju7v+L5xC A+zL/XYV8HoAIblG0lXI0UFuv2fXWFQL58Gp3it4xuChsiEQsqqQhP19igXfwyzEMo6gKd VU4uL64FRmu5L8uuAoK6kgCH5LcuTmt63ZlWpLOK3C5bgs+qEcZUUXGqlb9H5xVz3OxAbS xtN+0eXFcVRbdwUBBsmkpjP03e78KurXzYZAykKAlb7gXUcXHPDvrRthlIGCew== 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 4P0LCw0nCpzxdD; Sun, 22 Jan 2023 17:42:36 +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 30MHga6G067562; Sun, 22 Jan 2023 17:42:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30MHgZtg067560; Sun, 22 Jan 2023 17:42:35 GMT (envelope-from git) Date: Sun, 22 Jan 2023 17:42:35 GMT Message-Id: <202301221742.30MHgZtg067560@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: 940d212ecd7c - main - www/adguardhome: Move config and data files to a new location List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@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: 940d212ecd7c7226713724aebd6df76483100c3b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=940d212ecd7c7226713724aebd6df76483100c3b commit 940d212ecd7c7226713724aebd6df76483100c3b Author: Yuri Victorovich AuthorDate: 2023-01-22 17:39:50 +0000 Commit: Yuri Victorovich CommitDate: 2023-01-22 17:42:32 +0000 www/adguardhome: Move config and data files to a new location ... when these files are present at old locations. PR: 269083 Reported by: Jony Hudson --- UPDATING | 12 ++++++++++++ www/adguardhome/Makefile | 2 +- www/adguardhome/files/adguardhome.in | 32 +++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/UPDATING b/UPDATING index 9a7db786a272..d4fe28dc24ae 100644 --- a/UPDATING +++ b/UPDATING @@ -20884,3 +20884,15 @@ or The default installation is now configured for running bitlbee as user 'nobody' by default. Make sure any existing configuration files are readable by that user. + +20080122: + AFFECTS: users of www/adguardhome + AUTHOR: yuri@FreeBSD.org + + www/adguardhome now stores configuratio and database information in + $PREFIX/etc/AdGuardHome.yaml and /var/db/adguardhome/data + respectively. 'service adguardhome start' attempts to move config + and data files to the new location but it required manual move when + both old and new files are present. + 'service adguardhome start' prints a warning with relevant + location information. diff --git a/www/adguardhome/Makefile b/www/adguardhome/Makefile index c3f3023f16ad..bb7d8fe62725 100644 --- a/www/adguardhome/Makefile +++ b/www/adguardhome/Makefile @@ -1,7 +1,7 @@ PORTNAME= adguardhome DISTVERSIONPREFIX= v DISTVERSION= 0.107.21 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= www MAINTAINER= yuri@FreeBSD.org diff --git a/www/adguardhome/files/adguardhome.in b/www/adguardhome/files/adguardhome.in index 6a9fd0fb6532..474e2c8a83fa 100644 --- a/www/adguardhome/files/adguardhome.in +++ b/www/adguardhome/files/adguardhome.in @@ -15,10 +15,15 @@ rcvar=adguardhome_enable load_rc_config $name : ${adguardhome_enable:=NO} -: ${adguardhome_config:=/usr/local/etc/AdGuardHome.yaml} +: ${adguardhome_config:=%%PREFIX%%/etc/AdGuardHome.yaml} : ${adguardhome_user:=%%USER%%} : ${adguardhome_group:=%%GROUP%%} : ${adguardhome_work_dir:=/var/db/adguardhome} +: ${adguardhome_work_dir_data:=/var/db/adguardhome/data} + +# old values +: ${adguardhome_config_old:=%%PREFIX%%/bin/AdGuardHome.yaml} +: ${adguardhome_work_dir_data_old:=%%PREFIX%%/bin/data} logfile="/var/log/${name}.log" @@ -30,6 +35,31 @@ start_precmd="${name}_prestart" adguardhome_prestart() { + # check if the old config exists + if [ -f ${adguardhome_config_old} ] || [ -d ${adguardhome_work_dir_data_old} ]; then + if ! [ -f ${adguardhome_config} ] && ! [ -d ${adguardhome_work_dir_data} ]; then # old config exists, new config doesn't exist + # move old config to new locations + if [ -f ${adguardhome_config_old} ]; then + echo "moving old config ${adguardhome_config_old} to the new location ${adguardhome_config}" + mv ${adguardhome_config_old} ${adguardhome_config} + fi + if [ -d ${adguardhome_work_dir_data_old} ]; then + install -d -m 0750 -o ${adguardhome_user} -g ${adguardhome_group} \ + ${adguardhome_work_dir} + echo "moving old config ${adguardhome_work_dir_data_old} to the new location ${adguardhome_work_dir_data}" + mv ${adguardhome_work_dir_data_old} ${adguardhome_work_dir_data} + fi + else # both old and new config exist + echo "(!!!) WARNING ==================================================================" + echo "(!!!) WARNING Both old and new configs exist" + echo "(!!!) WARNING Please choose which configs do you need and remove the old configs" + echo "(!!!) WARNING OLD config locations: ${adguardhome_config_old} ${adguardhome_work_dir_data_old}" + echo "(!!!) WARNING NEW config locations: ${adguardhome_config} ${adguardhome_work_dir_data}" + echo "(!!!) WARNING ==================================================================" + fi + fi + + # install dir if [ ! -d ${adguardhome_work_dir} ]; then install -d -m 0750 -o ${adguardhome_user} -g ${adguardhome_group} \ ${adguardhome_work_dir}