From 9baecf63f8aa6a0965d9b949a1acf4b9821ffe26 Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Tue, 3 Mar 2026 12:20:55 +0100 Subject: [PATCH] Add util-linux package and update logger invocations. --- nix-system-configs/modules/system/traefik.nix | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/nix-system-configs/modules/system/traefik.nix b/nix-system-configs/modules/system/traefik.nix index 0926406..7f7d326 100644 --- a/nix-system-configs/modules/system/traefik.nix +++ b/nix-system-configs/modules/system/traefik.nix @@ -574,6 +574,11 @@ in { reloadServices = ["traefik.service"]; }; }; + + environment.systemPackages = with pkgs; [ + util-linux + ]; + # PRG Cloudflare DDNS updater - split into a single-run upstream script and a wrapper that loops records environment.etc."cloudflare-ddns/update-single.sh" = { text = '' @@ -613,16 +618,16 @@ in { RAW_IP=$(${pkgs.curl}/bin/curl -s $service) if [[ $RAW_IP =~ $REGEX_IPV4 ]]; then CURRENT_IP=$BASH_REMATCH - logger -s "DDNS Updater: Fetched IP $CURRENT_IP" + ${pkgs.util-linux}/bin/logger -s "DDNS Updater: Fetched IP $CURRENT_IP" break else - logger -s "DDNS Updater: IP service $service failed." + ${pkgs.util-linux}/bin/logger -s "DDNS Updater: IP service $service failed." fi done # Exit if IP fetching failed if [[ -z "$${CURRENT_IP}" ]]; then - logger -s "DDNS Updater: Failed to find a valid IP." + ${pkgs.util-linux}/bin/logger -s "DDNS Updater: Failed to find a valid IP." exit 2 fi @@ -639,7 +644,7 @@ in { ## Seek for the A record ########################################### - logger "DDNS Updater: Check Initiated" + ${pkgs.util-linux}/bin/logger "DDNS Updater: Check Initiated" record=$(${pkgs.curl}/bin/curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$${zone_identifier}/dns_records?type=A&name=$${record_name}" \ -H "X-Auth-Email: $${auth_email}" \ -H "$${auth_header} $${auth_key}" \ @@ -649,7 +654,7 @@ in { ## Check if the domain has an A record ########################################### if [[ $record == *"\\"count\\":0"* ]]; then - logger -s "DDNS Updater: Record does not exist, perhaps create one first? ($${CURRENT_IP} for $${record_name})" + ${pkgs.util-linux}/bin/logger -s "DDNS Updater: Record does not exist, perhaps create one first? ($${CURRENT_IP} for $${record_name})" exit 1 fi @@ -659,7 +664,7 @@ in { old_ip=$(echo "$record" | sed -E 's/.*"content":"(([0-9]{1,3}\\.){3}[0-9]{1,3})".*/\\1/') # Compare if they're the same if [[ $CURRENT_IP == $old_ip ]]; then - logger "DDNS Updater: IP ($CURRENT_IP) for $${record_name} has not changed." + ${pkgs.util-linux}/bin/logger "DDNS Updater: IP ($CURRENT_IP) for $${record_name} has not changed." exit 0 fi @@ -682,7 +687,7 @@ in { ########################################### case "$update" in *"\\\"success\\\":false"*) - echo -e "DDNS Updater: $${CURRENT_IP} $${record_name} DDNS failed for $${record_identifier} ($${CURRENT_IP}). DUMPING RESULTS:\n$update" | logger -s + echo -e "DDNS Updater: $${CURRENT_IP} $${record_name} DDNS failed for $${record_identifier} ($${CURRENT_IP}). DUMPING RESULTS:\n$update" | ${pkgs.util-linux}/bin/logger -s if [[ -n "$${slackuri}" ]]; then msg="$${sitename} DDNS Update Failed: $${record_name}: $${record_identifier} ($${CURRENT_IP})." ${pkgs.curl}/bin/curl -L -X POST "$${slackuri}" --data-raw "{\"channel\":\"$${slackchannel}\",\"text\":\"$${msg}\"}" @@ -694,7 +699,7 @@ in { exit 1;; *) msg="$${sitename} Updated: $${record_name}'s new IP Address is $${CURRENT_IP}" - logger "DDNS Updater: $${CURRENT_IP} $${record_name} DDNS updated." + ${pkgs.util-linux}/bin/logger "DDNS Updater: $${CURRENT_IP} $${record_name} DDNS updated." if [[ -n "$${slackuri}" ]]; then ${pkgs.curl}/bin/curl -L -X POST "$${slackuri}" --data-raw "{\"channel\":\"$${slackchannel}\",\"text\":\"$${msg}\"}" fi