Loading pkgs/by-name/pi/pihole/0001-Remove-sudo.patch +13 −12 Original line number Diff line number Diff line From 833856bd77dc6ea77557ab0659c1459bee393653 Mon Sep 17 00:00:00 2001 From 16f94593a18e7a0668df6ed9d4744252185e5876 Mon Sep 17 00:00:00 2001 From: averyv <avery@averyv.me> Date: Sat, 6 Sep 2025 17:51:48 +0100 Date: Sat, 6 Sep 2025 18:04:11 +0100 Subject: [PATCH 1/2] Remove sudo Rely on polkit and sensible permissions --- pihole | 8 -------- 1 file changed, 8 deletions(-) pihole | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pihole b/pihole index 7b5e3eb..b00617e 100755 index 5af46fa6..96acb1ae 100755 --- a/pihole +++ b/pihole @@ -570,14 +570,6 @@ if [[ -z ${USER} ]]; then @@ -587,15 +587,6 @@ if [[ -z ${USER} ]]; then USER=$(whoami) fi -# Check if the current user is not root and if the command -# requires root. If so, exit with an error message. -if [[ $EUID -ne 0 && need_root -eq 1 ]];then - echo -e " ${CROSS} The Pi-hole command requires root privileges, try:" -# Add an exception for the user "pihole" to allow the webserver running gravity -if [[ ( $EUID -ne 0 && ${USER} != "pihole" ) && -n "${need_root}" ]]; then - echo -e " ${CROSS} This Pi-hole command requires root privileges, try:" - echo -e " ${COL_GREEN}sudo pihole $*${COL_NC}" - exit 1 -fi - # Handle redirecting to specific functions based on arguments case "${1}" in "allow" | "allowlist" ) listFunc "$@";; "-d" | "debug" ) debugFunc "$@";; -- 2.50.1 2.50.1 (Apple Git-155) pkgs/by-name/pi/pihole/package.nix +9 −9 Original line number Diff line number Diff line Loading @@ -32,13 +32,13 @@ (resholve.mkDerivation rec { pname = "pihole"; version = "6.1.4"; version = "6.4"; src = fetchFromGitHub { owner = "pi-hole"; repo = "pi-hole"; tag = "v${version}"; hash = "sha256-2B2GUJKt4jHEjQLBx96FRuHpnLCTzE4UPDaeQvnDONc="; hash = "sha256-aBQO+wAqeuXc9ekByVFlOZQ9SBCGsozGdoS8r1qhGuk="; }; patches = [ Loading @@ -61,11 +61,11 @@ install -Dm 555 -t $out/bin pihole install -Dm 555 -t $scriptsDir/advanced/Scripts gravity.sh # The installation script is sourced by advanced/Scripts/piholeARPTable.sh etc # The installation script is sourced by advanced/Scripts/piholeDebug.sh etc cp --parents -r -t $scriptsDir/ 'automated install/' advanced/{Scripts,Templates}/ installShellCompletion --bash --name pihole.bash \ advanced/bash-completion/pihole advanced/bash-completion/pihole.bash runHook postInstall ''; Loading @@ -86,10 +86,10 @@ "${relativeScripts}/database_migration/gravity-db.sh" "${relativeScripts}/gravity.sh" "${relativeScripts}/list.sh" "${relativeScripts}/piholeARPTable.sh" "${relativeScripts}/piholeCheckout.sh" "${relativeScripts}/piholeDebug.sh" "${relativeScripts}/piholeLogFlush.sh" "${relativeScripts}/piholeNetworkFlush.sh" "${relativeScripts}/query.sh" "${relativeScripts}/update.sh" "${relativeScripts}/updatecheck.sh" Loading Loading @@ -129,6 +129,7 @@ "/etc/os-release" "/etc/pihole/versions" "/etc/pihole/setupVars.conf" "/opt/pihole/utils.sh" ]; external = [ # Used by chronometer.sh to get GPU information on Raspberry Pis Loading Loading @@ -178,6 +179,7 @@ "/etc/pihole/versions" "/etc/pihole/setupVars.conf" "$cachedVersions" "/opt/pihole/utils.sh" ]; "$PIHOLE_SETUP_VARS_FILE" = true; Loading @@ -190,9 +192,9 @@ "${scriptsDir}/api.sh" = true; "${scriptsDir}/gravity.sh" = true; "${scriptsDir}/list.sh" = true; "${scriptsDir}/piholeARPTable.sh" = true; "${scriptsDir}/piholeDebug.sh" = true; "${scriptsDir}/piholeLogFlush.sh" = true; "${scriptsDir}/piholeNetworkFlush.sh" = true; "${scriptsDir}/query.sh" = true; "${scriptsDir}/uninstall.sh" = true; "${scriptsDir}/update.sh" = true; Loading Loading @@ -241,9 +243,7 @@ passthru.tests = nixosTests.pihole-ftl; passthru = { inherit stateDir; }; passthru = { inherit stateDir; }; }).overrideAttrs (old: { # Resholve can't fix the hardcoded absolute paths, so substitute them before resholving Loading Loading
pkgs/by-name/pi/pihole/0001-Remove-sudo.patch +13 −12 Original line number Diff line number Diff line From 833856bd77dc6ea77557ab0659c1459bee393653 Mon Sep 17 00:00:00 2001 From 16f94593a18e7a0668df6ed9d4744252185e5876 Mon Sep 17 00:00:00 2001 From: averyv <avery@averyv.me> Date: Sat, 6 Sep 2025 17:51:48 +0100 Date: Sat, 6 Sep 2025 18:04:11 +0100 Subject: [PATCH 1/2] Remove sudo Rely on polkit and sensible permissions --- pihole | 8 -------- 1 file changed, 8 deletions(-) pihole | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pihole b/pihole index 7b5e3eb..b00617e 100755 index 5af46fa6..96acb1ae 100755 --- a/pihole +++ b/pihole @@ -570,14 +570,6 @@ if [[ -z ${USER} ]]; then @@ -587,15 +587,6 @@ if [[ -z ${USER} ]]; then USER=$(whoami) fi -# Check if the current user is not root and if the command -# requires root. If so, exit with an error message. -if [[ $EUID -ne 0 && need_root -eq 1 ]];then - echo -e " ${CROSS} The Pi-hole command requires root privileges, try:" -# Add an exception for the user "pihole" to allow the webserver running gravity -if [[ ( $EUID -ne 0 && ${USER} != "pihole" ) && -n "${need_root}" ]]; then - echo -e " ${CROSS} This Pi-hole command requires root privileges, try:" - echo -e " ${COL_GREEN}sudo pihole $*${COL_NC}" - exit 1 -fi - # Handle redirecting to specific functions based on arguments case "${1}" in "allow" | "allowlist" ) listFunc "$@";; "-d" | "debug" ) debugFunc "$@";; -- 2.50.1 2.50.1 (Apple Git-155)
pkgs/by-name/pi/pihole/package.nix +9 −9 Original line number Diff line number Diff line Loading @@ -32,13 +32,13 @@ (resholve.mkDerivation rec { pname = "pihole"; version = "6.1.4"; version = "6.4"; src = fetchFromGitHub { owner = "pi-hole"; repo = "pi-hole"; tag = "v${version}"; hash = "sha256-2B2GUJKt4jHEjQLBx96FRuHpnLCTzE4UPDaeQvnDONc="; hash = "sha256-aBQO+wAqeuXc9ekByVFlOZQ9SBCGsozGdoS8r1qhGuk="; }; patches = [ Loading @@ -61,11 +61,11 @@ install -Dm 555 -t $out/bin pihole install -Dm 555 -t $scriptsDir/advanced/Scripts gravity.sh # The installation script is sourced by advanced/Scripts/piholeARPTable.sh etc # The installation script is sourced by advanced/Scripts/piholeDebug.sh etc cp --parents -r -t $scriptsDir/ 'automated install/' advanced/{Scripts,Templates}/ installShellCompletion --bash --name pihole.bash \ advanced/bash-completion/pihole advanced/bash-completion/pihole.bash runHook postInstall ''; Loading @@ -86,10 +86,10 @@ "${relativeScripts}/database_migration/gravity-db.sh" "${relativeScripts}/gravity.sh" "${relativeScripts}/list.sh" "${relativeScripts}/piholeARPTable.sh" "${relativeScripts}/piholeCheckout.sh" "${relativeScripts}/piholeDebug.sh" "${relativeScripts}/piholeLogFlush.sh" "${relativeScripts}/piholeNetworkFlush.sh" "${relativeScripts}/query.sh" "${relativeScripts}/update.sh" "${relativeScripts}/updatecheck.sh" Loading Loading @@ -129,6 +129,7 @@ "/etc/os-release" "/etc/pihole/versions" "/etc/pihole/setupVars.conf" "/opt/pihole/utils.sh" ]; external = [ # Used by chronometer.sh to get GPU information on Raspberry Pis Loading Loading @@ -178,6 +179,7 @@ "/etc/pihole/versions" "/etc/pihole/setupVars.conf" "$cachedVersions" "/opt/pihole/utils.sh" ]; "$PIHOLE_SETUP_VARS_FILE" = true; Loading @@ -190,9 +192,9 @@ "${scriptsDir}/api.sh" = true; "${scriptsDir}/gravity.sh" = true; "${scriptsDir}/list.sh" = true; "${scriptsDir}/piholeARPTable.sh" = true; "${scriptsDir}/piholeDebug.sh" = true; "${scriptsDir}/piholeLogFlush.sh" = true; "${scriptsDir}/piholeNetworkFlush.sh" = true; "${scriptsDir}/query.sh" = true; "${scriptsDir}/uninstall.sh" = true; "${scriptsDir}/update.sh" = true; Loading Loading @@ -241,9 +243,7 @@ passthru.tests = nixosTests.pihole-ftl; passthru = { inherit stateDir; }; passthru = { inherit stateDir; }; }).overrideAttrs (old: { # Resholve can't fix the hardcoded absolute paths, so substitute them before resholving Loading