mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-25 20:25:28 +03:00
133 lines
4.5 KiB
Diff
133 lines
4.5 KiB
Diff
From c37c9fb3f12e1994c5a99210b7a84954192866e4 Mon Sep 17 00:00:00 2001
|
|
From: Mike Crute <mike@crute.us>
|
|
Date: Sat, 10 May 2025 15:55:25 -0700
|
|
Subject: [PATCH 2/3] Use variables for path roots
|
|
|
|
---
|
|
advanced/Scripts/list.sh | 7 ++++---
|
|
advanced/Scripts/piholeARPTable.sh | 8 +++++---
|
|
advanced/Scripts/query.sh | 2 +-
|
|
gravity.sh | 8 +++++---
|
|
4 files changed, 15 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/pi-hole-6.1.2/advanced/Scripts/list.sh b/pi-hole-6.1.2/advanced/Scripts/list.sh
|
|
index fa356f16..96050290 100755
|
|
--- a/pi-hole-6.1.2/advanced/Scripts/list.sh
|
|
+++ b/pi-hole-6.1.2/advanced/Scripts/list.sh
|
|
@@ -9,6 +9,7 @@
|
|
# 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 utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
|
# shellcheck source="./advanced/Scripts/utils.sh"
|
|
@@ -21,13 +22,13 @@ source "${apifile}"
|
|
# Determine database location
|
|
DBFILE=$(getFTLConfigValue "files.database")
|
|
if [ -z "$DBFILE" ]; then
|
|
- DBFILE="/etc/pihole/pihole-FTL.db"
|
|
+ DBFILE="${PI_HOLE_DATA_DIR}/pihole-FTL.db"
|
|
fi
|
|
|
|
# Determine gravity database location
|
|
GRAVITYDB=$(getFTLConfigValue "files.gravity")
|
|
if [ -z "$GRAVITYDB" ]; then
|
|
- GRAVITYDB="/etc/pihole/gravity.db"
|
|
+ GRAVITYDB="${PI_HOLE_DATA_DIR}/gravity.db"
|
|
fi
|
|
|
|
addmode=true
|
|
@@ -39,8 +40,8 @@ domList=()
|
|
typeId=""
|
|
comment=""
|
|
|
|
-colfile="/opt/pihole/COL_TABLE"
|
|
# shellcheck source="./advanced/Scripts/COL_TABLE"
|
|
+colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
|
source ${colfile}
|
|
|
|
helpFunc() {
|
|
diff --git a/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh b/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh
|
|
index c62acdbc..4f1dfe79 100755
|
|
--- a/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh
|
|
+++ b/pi-hole-6.1.2/advanced/Scripts/piholeARPTable.sh
|
|
@@ -9,13 +9,15 @@
|
|
# This file is copyright under the latest version of the EUPL.
|
|
# Please see LICENSE file for your rights under this license.
|
|
|
|
-coltable="/opt/pihole/COL_TABLE"
|
|
+readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
|
+readonly PI_HOLE_DATA_DIR="/etc/pihole"
|
|
+
|
|
+coltable="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
|
if [[ -f ${coltable} ]]; then
|
|
# shellcheck source="./advanced/Scripts/COL_TABLE"
|
|
source ${coltable}
|
|
fi
|
|
|
|
-readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
|
# shellcheck source=./advanced/Scripts/utils.sh
|
|
source "${utilsfile}"
|
|
@@ -23,7 +25,7 @@ source "${utilsfile}"
|
|
# Determine database location
|
|
DBFILE=$(getFTLConfigValue "files.database")
|
|
if [ -z "$DBFILE" ]; then
|
|
- DBFILE="/etc/pihole/pihole-FTL.db"
|
|
+ DBFILE="${PI_HOLE_DATA_DIR}/pihole-FTL.db"
|
|
fi
|
|
|
|
flushARP(){
|
|
diff --git a/pi-hole-6.1.2/advanced/Scripts/query.sh b/pi-hole-6.1.2/advanced/Scripts/query.sh
|
|
index 18c018dc..3b50cfc4 100755
|
|
--- a/pi-hole-6.1.2/advanced/Scripts/query.sh
|
|
+++ b/pi-hole-6.1.2/advanced/Scripts/query.sh
|
|
@@ -16,8 +16,8 @@ partial="false"
|
|
domain=""
|
|
|
|
# Source color table
|
|
-colfile="/opt/pihole/COL_TABLE"
|
|
# shellcheck source="./advanced/Scripts/COL_TABLE"
|
|
+colfile="${PI_HOLE_INSTALL_DIR}/COL_TABLE"
|
|
. "${colfile}"
|
|
|
|
# Source api functions
|
|
diff --git a/pi-hole-6.1.2/gravity.sh b/pi-hole-6.1.2/gravity.sh
|
|
index 16e459c6..37c1dff3 100755
|
|
--- a/pi-hole-6.1.2/gravity.sh
|
|
+++ b/pi-hole-6.1.2/gravity.sh
|
|
@@ -13,6 +13,7 @@
|
|
export LC_ALL=C
|
|
|
|
PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
|
+PI_HOLE_MIGRATIONS_DIR="/etc/.pihole/advanced/Scripts/database_migration"
|
|
# Source utils.sh for GetFTLConfigValue
|
|
utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
|
# shellcheck source=./advanced/Scripts/utils.sh
|
|
@@ -22,7 +23,7 @@ coltable="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
|
# shellcheck source=./advanced/Scripts/COL_TABLE
|
|
. "${coltable}"
|
|
# shellcheck source=./advanced/Scripts/database_migration/gravity-db.sh
|
|
-. "/etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh"
|
|
+. "${PI_HOLE_MIGRATIONS_DIR}/gravity-db.sh"
|
|
|
|
basename="pihole"
|
|
PIHOLE_COMMAND="/usr/local/bin/${basename}"
|
|
@@ -39,10 +40,11 @@ regexFile="${piholeDir}/regex.list"
|
|
adListFile="${piholeDir}/adlists.list"
|
|
|
|
piholeGitDir="/etc/.pihole"
|
|
+piholeSchemaTemplateDir="${piholeGitDir}/advanced/Templates"
|
|
GRAVITYDB=$(getFTLConfigValue files.gravity)
|
|
GRAVITY_TMPDIR=$(getFTLConfigValue files.gravity_tmp)
|
|
-gravityDBschema="${piholeGitDir}/advanced/Templates/gravity.db.sql"
|
|
-gravityDBcopy="${piholeGitDir}/advanced/Templates/gravity_copy.sql"
|
|
+gravityDBschema="${piholeSchemaTemplateDir}/gravity.db.sql"
|
|
+gravityDBcopy="${piholeSchemaTemplateDir}/gravity_copy.sql"
|
|
|
|
domainsExtension="domains"
|
|
curl_connect_timeout=10
|
|
--
|
|
2.49.0
|
|
|