From bfd5edcf86ea3886fb1cd241dbda35794cacaac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 10 May 2026 22:17:10 +0200 Subject: [PATCH] nixos/pihole-ftl: fix systemd.enableStrictShellChecks --- .../networking/pihole-ftl-setup-script.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/networking/pihole-ftl-setup-script.nix b/nixos/modules/services/networking/pihole-ftl-setup-script.nix index 944d180dda17..8aa7761c3b26 100644 --- a/nixos/modules/services/networking/pihole-ftl-setup-script.nix +++ b/nixos/modules/services/networking/pihole-ftl-setup-script.nix @@ -19,6 +19,7 @@ let in '' # Can't use -u (unset) because api.sh uses API_URL before it is set + set +u set -eo pipefail pihole="${lib.getExe pihole}" jq="${lib.getExe pkgs.jq}" @@ -29,22 +30,24 @@ in if [ ! -f '${cfg.settings.files.gravity}' ]; then $pihole -g # Send SIGRTMIN to FTL, which makes it reload the database, opening the newly created one - ${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name}) + ${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN "$(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})" fi + # shellcheck disable=SC1091 source ${pihole}/share/pihole/advanced/Scripts/api.sh + # shellcheck disable=SC1091 source ${pihole}/share/pihole/advanced/Scripts/utils.sh any_failed=0 addList() { - local payload="$1" + local payload="$1" result type error echo "Adding list: $payload" - local type=$($jq -r '.type' <<< "$payload") - local result=$(PostFTLData "lists?type=$type" "$payload") + type=$($jq -r '.type' <<< "$payload") + result=$(PostFTLData "lists?type=$type" "$payload") - local error="$($jq '.error' <<< "$result")" + error="$($jq '.error' <<< "$result")" if [[ "$error" != "null" ]]; then echo "Error: $error" any_failed=1 @@ -62,7 +65,7 @@ in echo "Added list ID $id: $result" } - for i in 1 2 3; do + for _ in 1 2 3; do (TestAPIAvailability) && break echo "Retrying API shortly..." ${lib.getExe' pkgs.coreutils "sleep"} .5s