aports/testing/pihole/0003-Use-FHS-paths.patch
2025-05-12 19:10:20 +00:00

144 lines
5.5 KiB
Diff

From c47cba7e24cf6033b3634e1063bbfc898e1e12d8 Mon Sep 17 00:00:00 2001
From: Mike Crute <mike@crute.us>
Date: Sat, 10 May 2025 15:57:01 -0700
Subject: [PATCH 3/3] Use FHS paths
---
advanced/Scripts/database_migration/gravity-db.sh | 2 +-
advanced/Scripts/list.sh | 4 ++--
advanced/Scripts/piholeARPTable.sh | 4 ++--
advanced/Scripts/query.sh | 2 +-
advanced/Templates/gravity_copy.sql | 2 +-
gravity.sh | 12 ++++++------
pihole | 5 +++--
7 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/pi-hole-6.0.6/advanced/Scripts/database_migration/gravity-db.sh b/pi-hole-6.0.6/advanced/Scripts/database_migration/gravity-db.sh
index b0982bcc..45089c8e 100755
--- a/pi-hole-6.0.6/advanced/Scripts/database_migration/gravity-db.sh
+++ b/pi-hole-6.0.6/advanced/Scripts/database_migration/gravity-db.sh
@@ -10,7 +10,7 @@
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
-readonly scriptPath="/etc/.pihole/advanced/Scripts/database_migration/gravity"
+readonly scriptPath="/usr/share/pihole/database_migration/gravity"
upgrade_gravityDB(){
local database piholeDir version
diff --git a/pi-hole-6.0.6/advanced/Scripts/list.sh b/pi-hole-6.0.6/advanced/Scripts/list.sh
index f19c1e26..ebf58738 100755
--- a/pi-hole-6.0.6/advanced/Scripts/list.sh
+++ b/pi-hole-6.0.6/advanced/Scripts/list.sh
@@ -10,8 +10,8 @@
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
-readonly PI_HOLE_DATA_DIR="/etc/pihole"
-readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
+readonly PI_HOLE_DATA_DIR="/var/lib/pihole"
+readonly PI_HOLE_SCRIPT_DIR="/usr/share/pihole"
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
source "${utilsfile}"
diff --git a/pi-hole-6.0.6/advanced/Scripts/piholeARPTable.sh b/pi-hole-6.0.6/advanced/Scripts/piholeARPTable.sh
index 369b7fb4..87bca1c1 100755
--- a/pi-hole-6.0.6/advanced/Scripts/piholeARPTable.sh
+++ b/pi-hole-6.0.6/advanced/Scripts/piholeARPTable.sh
@@ -10,8 +10,8 @@
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
-readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
-readonly PI_HOLE_DATA_DIR="/etc/pihole"
+readonly PI_HOLE_SCRIPT_DIR="/usr/share/pihole"
+readonly PI_HOLE_DATA_DIR="/var/lib/pihole"
coltable="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
if [[ -f ${coltable} ]]; then
diff --git a/pi-hole-6.0.6/advanced/Scripts/query.sh b/pi-hole-6.0.6/advanced/Scripts/query.sh
index ab7ca123..e78296b4 100755
--- a/pi-hole-6.0.6/advanced/Scripts/query.sh
+++ b/pi-hole-6.0.6/advanced/Scripts/query.sh
@@ -15,7 +15,7 @@
# Please see LICENSE file for your rights under this license.
# Globals
-PI_HOLE_INSTALL_DIR="/opt/pihole"
+PI_HOLE_INSTALL_DIR="/usr/share/pihole"
max_results="20"
partial="false"
domain=""
diff --git a/pi-hole-6.0.6/advanced/Templates/gravity_copy.sql b/pi-hole-6.0.6/advanced/Templates/gravity_copy.sql
index f9f98446..7ffe29d7 100644
--- a/pi-hole-6.0.6/advanced/Templates/gravity_copy.sql
+++ b/pi-hole-6.0.6/advanced/Templates/gravity_copy.sql
@@ -1,6 +1,6 @@
.timeout 30000
-ATTACH DATABASE '/etc/pihole/gravity.db' AS OLD;
+ATTACH DATABASE '/var/lib/pihole/gravity.db' AS OLD;
BEGIN TRANSACTION;
diff --git a/pi-hole-6.0.6/gravity.sh b/pi-hole-6.0.6/gravity.sh
index e0c031f4..90833213 100755
--- a/pi-hole-6.0.6/gravity.sh
+++ b/pi-hole-6.0.6/gravity.sh
@@ -13,8 +13,8 @@
export LC_ALL=C
-PI_HOLE_SCRIPT_DIR="/opt/pihole"
-PI_HOLE_MIGRATIONS_DIR="/etc/.pihole/advanced/Scripts/database_migration"
+PI_HOLE_SCRIPT_DIR="/usr/share/pihole"
+PI_HOLE_MIGRATIONS_DIR="${PI_HOLE_SCRIPT_DIR}/database_migration"
# Source utils.sh for GetFTLConfigValue
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
# shellcheck disable=SC1090
@@ -27,9 +27,9 @@ coltable="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
. "${PI_HOLE_MIGRATIONS_DIR}/gravity-db.sh"
basename="pihole"
-PIHOLE_COMMAND="/usr/local/bin/${basename}"
+PIHOLE_COMMAND="/usr/bin/${basename}"
-piholeDir="/etc/${basename}"
+piholeDir="/var/lib/pihole"
# Gravity aux files directory
listsCacheDir="${piholeDir}/listsCache"
@@ -40,8 +40,8 @@ blacklistFile="${piholeDir}/blacklist.txt"
regexFile="${piholeDir}/regex.list"
adListFile="${piholeDir}/adlists.list"
-piholeGitDir="/etc/.pihole"
-piholeSchemaTemplateDir="${piholeGitDir}/advanced/Templates"
+piholeGitDir="/usr/share/pihole"
+piholeSchemaTemplateDir="${piholeGitDir}/templates"
GRAVITYDB=$(getFTLConfigValue files.gravity)
GRAVITY_TMPDIR=$(getFTLConfigValue files.gravity_tmp)
gravityDBschema="${piholeSchemaTemplateDir}/gravity.db.sql"
diff --git a/pi-hole-6.0.6/pihole b/pi-hole-6.0.6/pihole
index 1b5d0834..f885a01c 100755
--- a/pi-hole-6.0.6/pihole
+++ b/pi-hole-6.0.6/pihole
@@ -9,12 +9,13 @@
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
-readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
+readonly LINUX_DISTRO_PACKAGE="Alpine"
+readonly PI_HOLE_SCRIPT_DIR="/usr/share/pihole"
# PI_HOLE_BIN_DIR is not readonly here because in some functions (checkout),
# they might get set again when the installer is sourced. This causes an
# error due to modifying a readonly variable.
-PI_HOLE_BIN_DIR="/usr/local/bin"
+PI_HOLE_BIN_DIR="/usr/bin"
readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
source "${colfile}"
--
2.45.2