From 2037dca7665398fbe6414093a00eed97bab577c9 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Mon, 6 Jun 2022 14:17:19 +0100 Subject: [PATCH] nixos/pdns: Fix file records content with spaces --- nixos/modules/pdns.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos/modules/pdns.nix b/nixos/modules/pdns.nix index cddab75..62326cd 100644 --- a/nixos/modules/pdns.nix +++ b/nixos/modules/pdns.nix @@ -91,11 +91,13 @@ let } add() { - if [ $# -ne 2 ]; then + if [ $# -lt 2 ]; then usage fi - echo "$2" >> "$dir"/"$1"txt + file="$dir"/"$1"txt + shift + echo "$@" >> "$file" } del() { if [ $# -lt 1 ]; then @@ -106,7 +108,8 @@ let if [ $# -eq 1 ]; then rm "$file" else - sed -i "/^""$2""$/!{q1}; /^""$2""$/d" "$file" + shift + sed -i "/^""$*""$/!{q1}; /^""$*""$/d" "$file" exit $? fi }