Re-append any aliases after changing dynamic dns provider

This commit is contained in:
Bob Mottram 2018-05-12 12:17:56 +01:00
parent 76fc730b00
commit 4c8756ad23
1 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,9 @@ function update_inadyn_config {
fi
if ! grep -q "$DDNS_PROVIDER" /etc/inadyn.conf; then
# store any previous aliases
grep 'alias ' /etc/inadyn.conf > /tmp/inadyn_aliases
# remove entry for any previous ddns
sed -i '/system /,$d' /etc/inadyn.conf
@ -61,6 +64,11 @@ function update_inadyn_config {
if [ "$DDNS_PASSWORD" ]; then
echo " password $DDNS_PASSWORD" >> /etc/inadyn.conf
fi
if [ -f /tmp/inadyn_aliases ]; then
cat /tmp/inadyn_aliases >> /etc/inadyn.conf
rm /tmp/inadyn_aliases
fi
else
# change username/password for an existing provider
if [ "$DDNS_USERNAME" ]; then