1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-26 04:35:39 +03:00
aports/testing/pihole/0003-Use-FHS-paths.patch
2025-06-09 21:18:43 -07:00

144 lines
5.5 KiB
Diff

From 794b47f4944d454e14c29d7a8e556ead0fde3b28 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.1.2/advanced/Scripts/database_migration/gravity-db.sh b/pi-hole-6.1.2/advanced/Scripts/database_migration/gravity-db.sh
index 41593368..fe16de13 100755
--- a/pi-hole-6.1.2/advanced/Scripts/database_migration/gravity-db.sh
+++ b/pi-hole-6.1.2/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 version
diff --git a/pi-hole-6.1.2/advanced/Scripts/list.sh b/pi-hole-6.1.2/advanced/Scripts/list.sh
index 96050290..dab4d9e5 100755
--- a/pi-hole-6.1.2/advanced/Scripts/list.sh
+++ b/pi-hole-6.1.2/advanced/Scripts/list.sh
@@ -9,8 +9,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"
# shellcheck source="./advanced/Scripts/utils.sh"
source "${utilsfile}"
diff --git a/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh b/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh
index 4f1dfe79..f95d8dba 100755
--- a/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh
+++ b/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh
@@ -9,8 +9,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.1.2/advanced/Scripts/query.sh b/pi-hole-6.1.2/advanced/Scripts/query.sh
index 3b50cfc4..7cc77de7 100755
--- a/pi-hole-6.1.2/advanced/Scripts/query.sh
+++ b/pi-hole-6.1.2/advanced/Scripts/query.sh
@@ -10,7 +10,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.1.2/advanced/Templates/gravity_copy.sql b/pi-hole-6.1.2/advanced/Templates/gravity_copy.sql
index f9f98446..7ffe29d7 100644
--- a/pi-hole-6.1.2/advanced/Templates/gravity_copy.sql
+++ b/pi-hole-6.1.2/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.1.2/gravity.sh b/pi-hole-6.1.2/gravity.sh
index 37c1dff3..9892094e 100755
--- a/pi-hole-6.1.2/gravity.sh
+++ b/pi-hole-6.1.2/gravity.sh
@@ -12,8 +12,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 source=./advanced/Scripts/utils.sh
@@ -26,9 +26,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"
@@ -39,8 +39,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.1.2/pihole b/pi-hole-6.1.2/pihole
index 76418828..eb46a147 100755
--- a/pi-hole-6.1.2/pihole
+++ b/pi-hole-6.1.2/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"
# shellcheck source=./advanced/Scripts/COL_TABLE
--
2.49.0