mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-26 04:35:39 +03:00
102 lines
3 KiB
Diff
102 lines
3 KiB
Diff
From 0db20dfe57cdb901efe3930230d40b58ed71c96b Mon Sep 17 00:00:00 2001
|
|
From: Mike Crute <mike@crute.us>
|
|
Date: Sat, 10 May 2025 15:40:34 -0700
|
|
Subject: [PATCH 1/3] Disallow some pihole commands for Linux distros
|
|
|
|
When Pi-hole is packaged as a Linux package several commands make
|
|
assumptions about the state of the system or the mutability of the
|
|
system that don't make sense and are managed by the distribution package
|
|
manager. Disable those commands to prevent corrupting the system.
|
|
---
|
|
pihole | 34 +++++++++++++++++++++++-----------
|
|
1 file changed, 23 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/pi-hole-6.1.2/pihole b/pi-hole-6.1.2/pihole
|
|
index 1dfab754..76418828 100755
|
|
--- a/pi-hole-6.1.2/pihole
|
|
+++ b/pi-hole-6.1.2/pihole
|
|
@@ -87,13 +87,21 @@ debugFunc() {
|
|
[[ "$value" == *"--check_database"* ]] && check_database_integrity="true"
|
|
done
|
|
|
|
- AUTOMATED=${automated:-} CHECK_DATABASE=${check_database_integrity:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh
|
|
- exit 0
|
|
+ if [ -n "${DOCKER_VERSION}" -o "${LINUX_DISTRO_PACKAGE}" ]; then
|
|
+ unsupportedFunc
|
|
+ else
|
|
+ AUTOMATED=${automated:-} CHECK_DATABASE=${check_database_integrity:-} "${PI_HOLE_SCRIPT_DIR}"/piholeDebug.sh
|
|
+ exit 0
|
|
+ fi
|
|
}
|
|
|
|
flushFunc() {
|
|
- "${PI_HOLE_SCRIPT_DIR}"/piholeLogFlush.sh "$@"
|
|
- exit 0
|
|
+ if [ -n "${DOCKER_VERSION}" -o "${LINUX_DISTRO_PACKAGE}" ]; then
|
|
+ unsupportedFunc
|
|
+ else
|
|
+ "${PI_HOLE_SCRIPT_DIR}"/piholeLogFlush.sh "$@"
|
|
+ exit 0
|
|
+ fi
|
|
}
|
|
|
|
arpFunc() {
|
|
@@ -102,7 +110,7 @@ arpFunc() {
|
|
}
|
|
|
|
updatePiholeFunc() {
|
|
- if [ -n "${DOCKER_VERSION}" ]; then
|
|
+ if [ -n "${DOCKER_VERSION}" -o "${LINUX_DISTRO_PACKAGE}" ]; then
|
|
unsupportedFunc
|
|
else
|
|
shift
|
|
@@ -112,7 +120,7 @@ updatePiholeFunc() {
|
|
}
|
|
|
|
repairPiholeFunc() {
|
|
- if [ -n "${DOCKER_VERSION}" ]; then
|
|
+ if [ -n "${DOCKER_VERSION}" -o "${LINUX_DISTRO_PACKAGE}" ]; then
|
|
unsupportedFunc
|
|
else
|
|
/etc/.pihole/automated\ install/basic-install.sh --repair
|
|
@@ -137,7 +145,7 @@ chronometerFunc() {
|
|
|
|
|
|
uninstallFunc() {
|
|
- if [ -n "${DOCKER_VERSION}" ]; then
|
|
+ if [ -n "${DOCKER_VERSION}" -o "${LINUX_DISTRO_PACKAGE}" ]; then
|
|
unsupportedFunc
|
|
else
|
|
"${PI_HOLE_SCRIPT_DIR}"/uninstall.sh
|
|
@@ -405,7 +413,7 @@ tailFunc() {
|
|
}
|
|
|
|
piholeCheckoutFunc() {
|
|
- if [ -n "${DOCKER_VERSION}" ]; then
|
|
+ if [ -n "${DOCKER_VERSION}" -o "${LINUX_DISTRO_PACKAGE}" ]; then
|
|
echo -e "${CROSS} Function not supported in Docker images"
|
|
echo "Please build a custom image following the steps at"
|
|
echo "https://github.com/pi-hole/docker-pi-hole?tab=readme-ov-file#building-the-image-locally"
|
|
@@ -460,12 +468,16 @@ tricorderFunc() {
|
|
}
|
|
|
|
updateCheckFunc() {
|
|
- "${PI_HOLE_SCRIPT_DIR}"/updatecheck.sh "$@"
|
|
- exit 0
|
|
+ if [ -n "${DOCKER_VERSION}" -o "${LINUX_DISTRO_PACKAGE}" ]; then
|
|
+ unsupportedFunc
|
|
+ else
|
|
+ "${PI_HOLE_SCRIPT_DIR}"/updatecheck.sh "$@"
|
|
+ exit 0
|
|
+ fi
|
|
}
|
|
|
|
unsupportedFunc(){
|
|
- echo "Function not supported in Docker images"
|
|
+ echo "Function not supported in this package format"
|
|
exit 0
|
|
}
|
|
|
|
--
|
|
2.49.0
|
|
|