nixos/estuary: Fix pdns-file-records clobbering .dat ownership

This commit is contained in:
Jack O'Sullivan 2022-06-06 13:48:03 +01:00
parent 77eaaf52c7
commit daa4ed45f5

View File

@ -13,7 +13,7 @@ let
pdns-file-record = pkgs.writeShellApplication { pdns-file-record = pkgs.writeShellApplication {
name = "pdns-file-record"; name = "pdns-file-record";
runtimeInputs = with pkgs; [ gnused pdns ]; runtimeInputs = with pkgs; [ gnused moreutils pdns ];
text = '' text = ''
die() { die() {
echo "$@" >&2 echo "$@" >&2
@ -69,7 +69,8 @@ let
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$zDat" source "$zDat"
((serial++)) ((serial++))
sed -i "s/^serial=.*$/serial=$serial/g" "$zDat" # Use sponge instead of `sed -i` because that actually uses a temporary file and clobbers ownership...
sed "s/^serial=.*$/serial=$serial/g" "$zDat" | sponge "$zDat"
sed "s/@@SERIAL@@/$serial/g" < /etc/pdns/bind-zones/"$zone".zone > /run/pdns/bind-zones/"$zone".zone sed "s/@@SERIAL@@/$serial/g" < /etc/pdns/bind-zones/"$zone".zone > /run/pdns/bind-zones/"$zone".zone
pdns_control bind-reload-now "$zone" pdns_control bind-reload-now "$zone"
''; '';