pihole: 6.1 -> 6.1.4
This commit is contained in:
@@ -29,8 +29,8 @@ in
|
||||
${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})
|
||||
fi
|
||||
|
||||
source ${pihole}/usr/share/pihole/advanced/Scripts/api.sh
|
||||
source ${pihole}/usr/share/pihole/advanced/Scripts/utils.sh
|
||||
source ${pihole}/share/pihole/advanced/Scripts/api.sh
|
||||
source ${pihole}/share/pihole/advanced/Scripts/utils.sh
|
||||
|
||||
any_failed=0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From a2b3aa45d6e073272608506b1d27e4f43f2b0032 Mon Sep 17 00:00:00 2001
|
||||
From: williamvds <william@williamvds.me>
|
||||
Date: Sun, 6 Apr 2025 23:00:41 +0100
|
||||
Subject: [PATCH 1/3] Remove sudo
|
||||
From 833856bd77dc6ea77557ab0659c1459bee393653 Mon Sep 17 00:00:00 2001
|
||||
From: averyv <avery@averyv.me>
|
||||
Date: Sat, 6 Sep 2025 17:51:48 +0100
|
||||
Subject: [PATCH 1/2] Remove sudo
|
||||
|
||||
Rely on polkit and sensible permissions
|
||||
---
|
||||
@@ -9,16 +9,16 @@ Rely on polkit and sensible permissions
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
diff --git a/pihole b/pihole
|
||||
index 1d5093c..6afc48a 100755
|
||||
index 7b5e3eb..b00617e 100755
|
||||
--- a/pihole
|
||||
+++ b/pihole
|
||||
@@ -570,14 +570,6 @@ if [[ -z ${USER} ]]; then
|
||||
USER=$(whoami)
|
||||
fi
|
||||
|
||||
-# Check if the current user is neither root nor pihole and if the command
|
||||
-# 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 && ${USER} != "pihole" && need_root -eq 1 ]];then
|
||||
-if [[ $EUID -ne 0 && need_root -eq 1 ]];then
|
||||
- echo -e " ${CROSS} The Pi-hole command requires root privileges, try:"
|
||||
- echo -e " ${COL_GREEN}sudo pihole $*${COL_NC}"
|
||||
- exit 1
|
||||
@@ -28,5 +28,5 @@ index 1d5093c..6afc48a 100755
|
||||
case "${1}" in
|
||||
"allow" | "allowlist" ) listFunc "$@";;
|
||||
--
|
||||
2.48.1
|
||||
2.50.1
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From ab0650484cdd89afb5b60a0a046509ec5ae14375 Mon Sep 17 00:00:00 2001
|
||||
From: williamvds <william@williamvds.me>
|
||||
Date: Sun, 6 Apr 2025 23:01:30 +0100
|
||||
Subject: [PATCH 2/3] Remove unsupported commands
|
||||
From d72475d713a8eecd1476bc5bb4acfb0448d5abad Mon Sep 17 00:00:00 2001
|
||||
From: averyv <avery@averyv.me>
|
||||
Date: Sat, 6 Sep 2025 18:04:11 +0100
|
||||
Subject: [PATCH 2/2] Remove unsupported commands
|
||||
|
||||
Remove some unsupported maintenance commands, particularly the ones which
|
||||
reinstall, update, and uninstall pihole. This is managed by NixOS, after all.
|
||||
@@ -10,7 +10,7 @@ reinstall, update, and uninstall pihole. This is managed by NixOS, after all.
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pihole b/pihole
|
||||
index 6afc48a..cce7c97 100755
|
||||
index b00617e..a3c2e20 100755
|
||||
--- a/pihole
|
||||
+++ b/pihole
|
||||
@@ -92,6 +92,7 @@ debugFunc() {
|
||||
@@ -63,5 +63,5 @@ index 6afc48a..cce7c97 100755
|
||||
|
||||
helpFunc() {
|
||||
--
|
||||
2.48.1
|
||||
2.50.1
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
From cca2f6437e3ba09019b8fcb1986b4558d7c6db4e Mon Sep 17 00:00:00 2001
|
||||
From: williamvds <william@williamvds.me>
|
||||
Date: Sat, 31 May 2025 13:43:42 +0100
|
||||
Subject: [PATCH 3/3] Fix redefinition of readonly variable utilsfile
|
||||
|
||||
---
|
||||
advanced/Scripts/api.sh | 2 +-
|
||||
pihole | 10 +++-------
|
||||
2 files changed, 4 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/advanced/Scripts/api.sh b/advanced/Scripts/api.sh
|
||||
index 613a8d8..8720043 100755
|
||||
--- a/advanced/Scripts/api.sh
|
||||
+++ b/advanced/Scripts/api.sh
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
TestAPIAvailability() {
|
||||
|
||||
- local chaos_api_list authResponse authStatus authData apiAvailable DNSport
|
||||
+ local chaos_api_list authResponse authStatus authData apiAvailable DNSport utilsfile
|
||||
|
||||
# as we are running locally, we can get the port value from FTL directly
|
||||
readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
diff --git a/pihole b/pihole
|
||||
index cce7c97..d63d064 100755
|
||||
--- a/pihole
|
||||
+++ b/pihole
|
||||
@@ -16,18 +16,14 @@ readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
|
||||
# error due to modifying a readonly variable.
|
||||
PI_HOLE_BIN_DIR="/usr/local/bin"
|
||||
|
||||
-readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
||||
# shellcheck source=./advanced/Scripts/COL_TABLE
|
||||
-source "${colfile}"
|
||||
+source "${PI_HOLE_SCRIPT_DIR}/COL_TABLE"
|
||||
|
||||
-readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
# shellcheck source=./advanced/Scripts/utils.sh
|
||||
-source "${utilsfile}"
|
||||
+source "${PI_HOLE_SCRIPT_DIR}/utils.sh"
|
||||
|
||||
-# Source api functions
|
||||
-readonly apifile="${PI_HOLE_SCRIPT_DIR}/api.sh"
|
||||
# shellcheck source=./advanced/Scripts/api.sh
|
||||
-source "${apifile}"
|
||||
+source "${PI_HOLE_SCRIPT_DIR}/api.sh"
|
||||
|
||||
versionsfile="/etc/pihole/versions"
|
||||
if [ -f "${versionsfile}" ]; then
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
|
||||
(resholve.mkDerivation rec {
|
||||
pname = "pihole";
|
||||
version = "6.1";
|
||||
version = "6.1.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pi-hole";
|
||||
repo = "pi-hole";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-aEnv8Lhb5vf0yDyuriVTaUY1wcdVmTdqoK+KDHvT/Lw=";
|
||||
hash = "sha256-2B2GUJKt4jHEjQLBx96FRuHpnLCTzE4UPDaeQvnDONc=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
@@ -45,8 +45,6 @@
|
||||
./0001-Remove-sudo.patch
|
||||
# Disable unsupported subcommands, particularly those for imperatively installing/upgrading Pi-hole
|
||||
./0002-Remove-unsupported-commands.patch
|
||||
# Fix a readonly variable error caused by defining a shadowing local variable
|
||||
./0003-Fix-redefinition-of-readonly-variable-utilsfile.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
@@ -57,7 +55,7 @@
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
readonly scriptsDir=$out/usr/share/pihole
|
||||
readonly scriptsDir=$out/share/pihole
|
||||
|
||||
install -Dm 555 -t $out/bin pihole
|
||||
install -Dm 555 -t $scriptsDir/advanced/Scripts gravity.sh
|
||||
@@ -74,12 +72,12 @@
|
||||
solutions.default =
|
||||
let
|
||||
out = builtins.placeholder "out";
|
||||
scriptsDir = "${out}/usr/share/pihole/advanced/Scripts";
|
||||
scriptsDir = "${out}/share/pihole/advanced/Scripts";
|
||||
in
|
||||
{
|
||||
scripts =
|
||||
let
|
||||
relativeScripts = "usr/share/pihole/advanced/Scripts";
|
||||
relativeScripts = "share/pihole/advanced/Scripts";
|
||||
in
|
||||
[
|
||||
"bin/pihole"
|
||||
@@ -101,7 +99,7 @@
|
||||
inputs = [
|
||||
# TODO: see if these inputs can help resholving
|
||||
"bin"
|
||||
"usr/share/pihole/advanced/Scripts"
|
||||
"share/pihole/advanced/Scripts"
|
||||
|
||||
bash
|
||||
coreutils
|
||||
@@ -150,16 +148,16 @@
|
||||
};
|
||||
fix = {
|
||||
"$PI_HOLE_BIN_DIR" = [ "${out}/bin" ];
|
||||
"$PI_HOLE_FILES_DIR" = [ "${out}/usr/share/pihole" ];
|
||||
"$PI_HOLE_FILES_DIR" = [ "${out}/share/pihole" ];
|
||||
"$PI_HOLE_INSTALL_DIR" = [ scriptsDir ];
|
||||
"$PI_HOLE_LOCAL_REPO" = [ "${out}/usr/share/pihole" ];
|
||||
"$PI_HOLE_LOCAL_REPO" = [ "${out}/share/pihole" ];
|
||||
"$PI_HOLE_SCRIPT_DIR" = [ scriptsDir ];
|
||||
"$colfile" = [ "${scriptsDir}/COL_TABLE" ];
|
||||
"$coltable" = [ "${scriptsDir}/COL_TABLE" ];
|
||||
"$PIHOLE_COLTABLE_FILE" = [ "${scriptsDir}/COL_TABLE" ];
|
||||
"$utilsfile" = [ "${scriptsDir}/utils.sh" ];
|
||||
"$apifile" = [ "${scriptsDir}/api.sh" ];
|
||||
"$piholeGitDir" = [ "${out}/usr/share/pihole" ];
|
||||
"$piholeGitDir" = [ "${out}/share/pihole" ];
|
||||
"$PIHOLE_COMMAND" = [ "pihole" ];
|
||||
};
|
||||
keep = {
|
||||
@@ -168,7 +166,7 @@
|
||||
"$setupVars" # Global config file
|
||||
"$PIHOLE_SETUP_VARS_FILE"
|
||||
"$versionsfile" # configuration file, doesn't exist on NixOS
|
||||
"${out}/usr/share/pihole/automated install/basic-install.sh"
|
||||
"${out}/share/pihole/automated install/basic-install.sh"
|
||||
"${scriptsDir}/COL_TABLE"
|
||||
"${scriptsDir}/database_migration/gravity-db.sh"
|
||||
"${scriptsDir}/gravity.sh"
|
||||
@@ -213,8 +211,8 @@
|
||||
# both quoted and escaped. Resholve apparently requires matching the
|
||||
# literal path, so we need to provide a version with and without the
|
||||
# backslash.
|
||||
"'${out}/usr/share/pihole/automated\\ install/basic-install.sh'" = true;
|
||||
"'${out}/usr/share/pihole/automated install/basic-install.sh'" = true;
|
||||
"'${out}/share/pihole/automated\\ install/basic-install.sh'" = true;
|
||||
"'${out}/share/pihole/automated install/basic-install.sh'" = true;
|
||||
|
||||
"/etc/.pihole" = true; # Patched with an override
|
||||
"/etc/os-release" = true;
|
||||
@@ -232,6 +230,8 @@
|
||||
|
||||
meta = {
|
||||
description = "Black hole for Internet advertisements";
|
||||
homepage = "https://pi-hole.net";
|
||||
changelog = "https://github.com/pi-hole/pi-hole/releases/tag/v${version}";
|
||||
license = lib.licenses.eupl12;
|
||||
maintainers = with lib.maintainers; [ averyvigolo ];
|
||||
platforms = lib.platforms.linux;
|
||||
@@ -239,13 +239,13 @@
|
||||
};
|
||||
|
||||
passthru = {
|
||||
stateDir = stateDir;
|
||||
inherit stateDir;
|
||||
};
|
||||
}).overrideAttrs
|
||||
(old: {
|
||||
# Resholve can't fix the hardcoded absolute paths, so substitute them before resholving
|
||||
preFixup = ''
|
||||
scriptsDir=$out/usr/share/pihole
|
||||
scriptsDir=$out/share/pihole
|
||||
|
||||
substituteInPlace $out/bin/pihole $scriptsDir/advanced/Scripts/*.sh \
|
||||
--replace-quiet /etc/.pihole $scriptsDir \
|
||||
|
||||
Reference in New Issue
Block a user