k7dxs-dns/update-lester.sh
2025-11-26 15:20:38 -07:00

14 lines
366 B
Bash
Executable file

#!/bin/bash
set -ex
oldip="$(grep -Po '^lester.* \K(\d+\.){3}\d+$' zones/xaviera.systems.zone)"
newip="$(curl -fsS https://ipv4.icanhazip.com)"
[[ "$oldip" = "$newip" ]] && { echo "Nothing to do"; exit; }
for file in $(grep -lr "$oldip"); do
sed -i "s/${oldip}/${newip}/g" "$file"
awk -i inplace '/; serial/{sub(/[0-9]+/, $1+1)} 1' "$file"
done
git diff